From af9f4c77dba4c29479ed99ea57bb26c69526fce0 Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Thu, 11 Jun 2026 18:47:34 +0300 Subject: [PATCH] fix(frontend): let Escape leave the tag search field in the viewer The viewer's tag picker focuses its search input on `e`, but the input swallowed every key and the viewer's own handler bails on input targets, so there was no keyboard way out of the field. Escape now blurs the input back to the page, restoring arrow/Escape navigation in the viewer (a second Escape then closes it). Co-Authored-By: Claude Opus 4.8 --- frontend/src/lib/components/file/TagPicker.svelte | 6 ++++++ frontend/src/lib/components/layout/KeyboardHelp.svelte | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/file/TagPicker.svelte b/frontend/src/lib/components/file/TagPicker.svelte index 870c94f..2be3fc3 100644 --- a/frontend/src/lib/components/file/TagPicker.svelte +++ b/frontend/src/lib/components/file/TagPicker.svelte @@ -109,6 +109,12 @@ void handleRemove(tag.id); assignedFocusIdx = Math.min(assignedFocusIdx, filteredAssigned.length - 2); } + } else if (e.key === 'Escape') { + // Let the keyboard leave the field: blur back to the page so arrow keys + // and Escape reach the viewer again (e.g. a second Esc closes it). + e.preventDefault(); + assignedFocusIdx = -1; + (e.currentTarget as HTMLInputElement).blur(); } } diff --git a/frontend/src/lib/components/layout/KeyboardHelp.svelte b/frontend/src/lib/components/layout/KeyboardHelp.svelte index ee37712..3410181 100644 --- a/frontend/src/lib/components/layout/KeyboardHelp.svelte +++ b/frontend/src/lib/components/layout/KeyboardHelp.svelte @@ -49,7 +49,7 @@ ['& | ! ( )', 'Insert an operator (filter only)'], ['Ctrl+Enter', 'Apply the filter'], ['Ctrl+Backspace', 'Reset the filter'], - ['Esc', 'Close'] + ['Esc', 'Leave the field / close'] ] } ];