Fix command palette escape in fullscreen (#1008)

This commit is contained in:
ZacharyZcR
2026-07-10 08:02:43 +08:00
committed by GitHub
parent 37f9402060
commit 38c5932aa9
+7 -3
View File
@@ -126,14 +126,18 @@ export function CommandPalette({
}, [isOpen]);
useEffect(() => {
if (!isOpen) return;
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === "Escape") {
e.preventDefault();
e.stopPropagation();
setIsOpen(false);
}
};
window.addEventListener("keydown", handleKeyDown);
return () => window.removeEventListener("keydown", handleKeyDown);
}, [setIsOpen]);
window.addEventListener("keydown", handleKeyDown, true);
return () => window.removeEventListener("keydown", handleKeyDown, true);
}, [isOpen, setIsOpen]);
const filteredHosts = hosts.filter(
(h) =>