Escape progressively unfocuses then navigates home
First Escape blurs the active input (reaching neutral state where shortcuts work), second Escape navigates home. Allows full keyboard navigation without touching the mouse to leave a focused field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -52,16 +52,18 @@ function onGlobalKeydown(e: KeyboardEvent) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Escape — close shortcuts overlay OR navigate home
|
||||
// Escape — progressive: close overlay → unfocus field → go home
|
||||
if (e.key === "Escape") {
|
||||
clearPrefix();
|
||||
if (showShortcuts.value) {
|
||||
closeShortcuts();
|
||||
return;
|
||||
}
|
||||
if (!isInputActive()) {
|
||||
router.push("/");
|
||||
if (isInputActive()) {
|
||||
(document.activeElement as HTMLElement).blur();
|
||||
return;
|
||||
}
|
||||
router.push("/");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -173,7 +175,7 @@ onUnmounted(() => {
|
||||
</div>
|
||||
<div class="shortcut-row">
|
||||
<kbd class="shortcut-key">Esc</kbd>
|
||||
<span class="shortcut-desc">Go home (when not typing)</span>
|
||||
<span class="shortcut-desc">Unfocus field → go home</span>
|
||||
</div>
|
||||
<div class="shortcut-row">
|
||||
<kbd class="shortcut-key">?</kbd>
|
||||
|
||||
Reference in New Issue
Block a user