diff --git a/src/lib/components/AppLayout.svelte b/src/lib/components/AppLayout.svelte index 485ebf1..94b529e 100644 --- a/src/lib/components/AppLayout.svelte +++ b/src/lib/components/AppLayout.svelte @@ -578,6 +578,11 @@ } if (e.key === 'Escape') { + const dismissesAppUi = $showSettings || $showInfo || $focusMode || $showSearch || $showCommandPalette; + if (!dismissesAppUi) return; + + e.preventDefault(); + e.stopPropagation(); if ($showSettings) $showSettings = false; else if ($showInfo) $showInfo = false; else if ($focusMode) $focusMode = false; diff --git a/src/lib/components/CommandPalette.svelte b/src/lib/components/CommandPalette.svelte index 4b68c00..4fc70c5 100644 --- a/src/lib/components/CommandPalette.svelte +++ b/src/lib/components/CommandPalette.svelte @@ -164,10 +164,15 @@ } }); + function handleEscape(e: KeyboardEvent) { + if (e.key !== 'Escape') return; + e.preventDefault(); + e.stopPropagation(); + $showCommandPalette = false; + } + function handleKeydown(e: KeyboardEvent) { - if (e.key === 'Escape') { - $showCommandPalette = false; - } else if (e.key === 'ArrowDown') { + if (e.key === 'ArrowDown') { e.preventDefault(); selectedIndex = Math.min(selectedIndex + 1, filteredCommands.length - 1); } else if (e.key === 'ArrowUp') { @@ -194,7 +199,7 @@ {#if $showCommandPalette} -