Skip to content

Commit 47050e0

Browse files
committed
Settings: ESC clears key filter, hint text
- ESC key now clears the "Filter by keys..." filter - Added instruction
1 parent b540fcc commit 47050e0

1 file changed

Lines changed: 46 additions & 13 deletions

File tree

apps/desktop/src/lib/settings/sections/KeyboardShortcutsSection.svelte

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,16 @@
285285
// Let Tab through for focus navigation
286286
if (event.key === 'Tab') return
287287
288+
// ESC clears the filter when it has a value; otherwise let it bubble (closes window)
289+
if (event.key === 'Escape') {
290+
if (keySearchQuery) {
291+
event.preventDefault()
292+
event.stopImmediatePropagation()
293+
keySearchQuery = ''
294+
}
295+
return
296+
}
297+
288298
event.preventDefault()
289299
event.stopPropagation()
290300
@@ -354,18 +364,21 @@
354364
autocapitalize="off"
355365
spellcheck="false"
356366
/>
357-
<input
358-
type="text"
359-
class="search-input key-search"
360-
placeholder="Filter by keys..."
361-
bind:value={keySearchQuery}
362-
bind:this={keyFilterInput}
363-
onkeydown={handleKeyFilterKeyDown}
364-
onkeyup={handleKeyFilterKeyUp}
365-
autocomplete="off"
366-
autocapitalize="off"
367-
spellcheck="false"
368-
/>
367+
<div class="key-search-wrapper">
368+
<input
369+
type="text"
370+
class="search-input key-search"
371+
placeholder="Filter by keys..."
372+
bind:value={keySearchQuery}
373+
bind:this={keyFilterInput}
374+
onkeydown={handleKeyFilterKeyDown}
375+
onkeyup={handleKeyFilterKeyUp}
376+
autocomplete="off"
377+
autocapitalize="off"
378+
spellcheck="false"
379+
/>
380+
<span class="key-search-hint" class:visible={!!keySearchQuery}>Press ESC to clear</span>
381+
</div>
369382
</div>
370383

371384
<div class="filters">
@@ -532,8 +545,28 @@
532545
box-shadow: var(--shadow-focus);
533546
}
534547
535-
.key-search {
548+
.key-search-wrapper {
536549
flex: 0.5;
550+
position: relative;
551+
}
552+
553+
.key-search {
554+
width: 100%;
555+
}
556+
557+
.key-search-hint {
558+
position: absolute;
559+
top: 100%;
560+
left: 0;
561+
margin-top: 2px;
562+
font-size: var(--font-size-xs);
563+
color: var(--color-text-tertiary);
564+
opacity: 0;
565+
transition: opacity 0.15s;
566+
}
567+
568+
.key-search-hint.visible {
569+
opacity: 1;
537570
}
538571
539572
.filters {

0 commit comments

Comments
 (0)