diff --git a/pkg/grid/src/nav/Nav.tsx b/pkg/grid/src/nav/Nav.tsx index 798c433724..22fadc5438 100644 --- a/pkg/grid/src/nav/Nav.tsx +++ b/pkg/grid/src/nav/Nav.tsx @@ -85,11 +85,7 @@ export const Nav: FunctionComponent = ({ menu }) => { const dialogNavRef = useRef(null); const [systemMenuOpen, setSystemMenuOpen] = useState(false); const [dialogContentOpen, setDialogContentOpen] = useState(false); - const { selection, select } = useLeapStore((state) => ({ - selectedMatch: state.selectedMatch, - selection: state.selection, - select: state.select - })); + const select = useLeapStore((state) => state.select); const menuState = menu || 'closed'; const isOpen = menuState !== 'closed'; @@ -99,10 +95,8 @@ export const Nav: FunctionComponent = ({ menu }) => { if (!isOpen) { select(null); setDialogContentOpen(false); - } else { - inputRef.current?.focus(); } - }, [selection, isOpen]); + }, [isOpen]); const onOpen = useCallback( (event: Event) => { @@ -124,6 +118,15 @@ export const Nav: FunctionComponent = ({ menu }) => { } }, []); + const disableCloseWhenDropdownOpen = useCallback( + (e: Event) => { + if (systemMenuOpen) { + e.preventDefault(); + } + }, + [systemMenuOpen] + ); + return ( <> = ({ menu }) => { = ({ menu }) => {