From bfd7655c077bc3fb55e23c4c4e1c470072203bf1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 22:37:22 +0000 Subject: [PATCH 1/2] Add Escape key handler to clear search input Co-authored-by: AhmmedSamier <17784876+AhmmedSamier@users.noreply.github.com> --- .jules/palette.md | 3 +++ vscode-extension/src/webviews/search-view.html | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.jules/palette.md b/.jules/palette.md index 9e76393..c68d55a 100644 --- a/.jules/palette.md +++ b/.jules/palette.md @@ -99,3 +99,6 @@ ## 2026-07-01 - Prevent Focus Stealing in Search Filter Buttons **Learning:** In hybrid mouse/keyboard search interfaces (like VS Code Webviews), clicking interactive elements like filter buttons steals DOM focus from the primary search input. This forces users to manually click back into the input or hit Tab before they can resume typing. **Action:** When implementing filter or scope toggle buttons that don't need their own text-input focus, attach a `mousedown` event listener that calls `e.preventDefault()`. This prevents the browser's default focus transition before it even fires, ensuring the user's cursor remains firmly anchored in the main search input. +## 2026-07-02 - Actionable Escape-to-Clear Shortcut +**Learning:** Users often press the Escape key intuitively to clear a search input, especially when it has filters applied. Lacking this native behavior adds friction, as users are forced to manually highlight and delete the text or click a "Clear" button. +**Action:** When implementing complex search inputs, always bind the `Escape` key to clear the query and reset filters, mirroring native search interface expectations. diff --git a/vscode-extension/src/webviews/search-view.html b/vscode-extension/src/webviews/search-view.html index a4ce668..2ee20bc 100644 --- a/vscode-extension/src/webviews/search-view.html +++ b/vscode-extension/src/webviews/search-view.html @@ -1179,7 +1179,16 @@ } searchInput.addEventListener('keydown', (e) => { - if (e.key === 'ArrowDown') { + if (e.key === 'Escape' && searchInput.value !== '') { + e.preventDefault(); + searchInput.value = ''; + currentScope = 'everything'; + userScope = 'everything'; + updateScopeButtons(); + triggerSearchFromInput(''); + searchInput.focus(); + showStatus('Search and filters cleared'); + } else if (e.key === 'ArrowDown') { e.preventDefault(); selectItem(Math.min(selectedIndex + 1, visibleEntries.length - 1)); const selection = getEffectiveSelection(selectedIndex); From 84d1b5c8af070ced118d47e65200fa42bed5dd41 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 23:35:58 +0000 Subject: [PATCH 2/2] Actionable Escape-to-Clear Shortcut Co-authored-by: AhmmedSamier <17784876+AhmmedSamier@users.noreply.github.com> --- .jules/palette.md | 5 +++-- vscode-extension/src/webviews/search-view.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.jules/palette.md b/.jules/palette.md index c68d55a..eb02b70 100644 --- a/.jules/palette.md +++ b/.jules/palette.md @@ -99,6 +99,7 @@ ## 2026-07-01 - Prevent Focus Stealing in Search Filter Buttons **Learning:** In hybrid mouse/keyboard search interfaces (like VS Code Webviews), clicking interactive elements like filter buttons steals DOM focus from the primary search input. This forces users to manually click back into the input or hit Tab before they can resume typing. **Action:** When implementing filter or scope toggle buttons that don't need their own text-input focus, attach a `mousedown` event listener that calls `e.preventDefault()`. This prevents the browser's default focus transition before it even fires, ensuring the user's cursor remains firmly anchored in the main search input. + ## 2026-07-02 - Actionable Escape-to-Clear Shortcut -**Learning:** Users often press the Escape key intuitively to clear a search input, especially when it has filters applied. Lacking this native behavior adds friction, as users are forced to manually highlight and delete the text or click a "Clear" button. -**Action:** When implementing complex search inputs, always bind the `Escape` key to clear the query and reset filters, mirroring native search interface expectations. +**Learning:** Users intuitively expect the `Escape` key to clear a search input and reset applied filters. A common edge case is when a user has manually backspaced their query but filters are still active; the `Escape` key must still function as a complete reset path in this state. +**Action:** When implementing `Escape` to clear search inputs, ensure the logic checks for *both* an active query and active filters, so users are never trapped in an empty-input-but-filtered state. diff --git a/vscode-extension/src/webviews/search-view.html b/vscode-extension/src/webviews/search-view.html index 2ee20bc..ff482a4 100644 --- a/vscode-extension/src/webviews/search-view.html +++ b/vscode-extension/src/webviews/search-view.html @@ -1179,7 +1179,7 @@ } searchInput.addEventListener('keydown', (e) => { - if (e.key === 'Escape' && searchInput.value !== '') { + if (e.key === 'Escape' && (searchInput.value !== '' || currentScope !== 'everything')) { e.preventDefault(); searchInput.value = ''; currentScope = 'everything';