From a86a39c5ee50272c988a9b3bb30b61c959888603 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 21 Oct 2022 22:02:36 -0700 Subject: [PATCH] quicklook shouldnt retain focus after close, also fixes esc key --- src/components/quicklaunch.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/quicklaunch.jsx b/src/components/quicklaunch.jsx index 78d0a8ab7..077e6c5c0 100644 --- a/src/components/quicklaunch.jsx +++ b/src/components/quicklaunch.jsx @@ -33,8 +33,11 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear } function handleSearchKeyDown(event) { + if (!isOpen) return; + if (event.key === "Escape") { closeAndReset(); + event.preventDefault(); } else if (event.key === "Enter" && results.length) { closeAndReset(); openCurrentItem(event.metaKey); @@ -94,6 +97,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear setHidden(false); } else { document.body.removeEventListener('click', handleBackdropClick); + searchField.current.blur(); setTimeout(() => { setHidden(true); }, 300); // disable on close