quicklook shouldnt retain focus after close, also fixes esc key

pull/435/head
Michael Shamoon 2 years ago
parent 45608b76b1
commit a86a39c5ee

@ -33,8 +33,11 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
} }
function handleSearchKeyDown(event) { function handleSearchKeyDown(event) {
if (!isOpen) return;
if (event.key === "Escape") { if (event.key === "Escape") {
closeAndReset(); closeAndReset();
event.preventDefault();
} else if (event.key === "Enter" && results.length) { } else if (event.key === "Enter" && results.length) {
closeAndReset(); closeAndReset();
openCurrentItem(event.metaKey); openCurrentItem(event.metaKey);
@ -94,6 +97,7 @@ export default function QuickLaunch({servicesAndBookmarks, searchString, setSear
setHidden(false); setHidden(false);
} else { } else {
document.body.removeEventListener('click', handleBackdropClick); document.body.removeEventListener('click', handleBackdropClick);
searchField.current.blur();
setTimeout(() => { setTimeout(() => {
setHidden(true); setHidden(true);
}, 300); // disable on close }, 300); // disable on close

Loading…
Cancel
Save