Skip to content

🎨 Palette: Add Escape shortcut to clear search#94

Open
SlasshyOverhere wants to merge 1 commit into
mainfrom
palette-search-escape-11726321910484380364
Open

🎨 Palette: Add Escape shortcut to clear search#94
SlasshyOverhere wants to merge 1 commit into
mainfrom
palette-search-escape-11726321910484380364

Conversation

@SlasshyOverhere
Copy link
Copy Markdown
Owner

@SlasshyOverhere SlasshyOverhere commented Apr 3, 2026

Adds an Escape key listener to the search input in the Web UI to clear the value, blur the input, and refresh entries, improving keyboard navigation.


PR created automatically by Jules for task 11726321910484380364 started by @SlasshyOverhere

Summary by CodeRabbit

  • New Features
    • Added Escape key support in search inputs, allowing users to instantly clear search fields and exit focus for faster navigation and a more intuitive experience.

@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings April 3, 2026 15:00
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

📝 Walkthrough

Walkthrough

Added documentation and implementation for an Escape key shortcut on the search input. The keydown handler intercepts the Escape key, prevents default behavior, clears the search field, removes focus via blur, and immediately triggers a view refresh through refreshEntries().

Changes

Cohort / File(s) Summary
Escape Key Handler Implementation
.jules/palette.md, src/webui/template.ts
Added guidance documentation and keydown event handler for Escape key on search input. Handler prevents default action, clears the search field, blurs focus, and triggers immediate refreshEntries() refresh without debouncing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • SlasshyOverhere/BlankDrive#85: Modifies keyboard handling for the same search input in src/webui/template.ts, adding a global "/" shortcut to focus the search field with updated placeholder and accessibility attributes.

Poem

🐰 A hop, a skip, press Escape with care,
The search field clears into the air,
With focus lost and entries fresh,
The UI responds without a mesh,
Simple shortcuts make users smile,
One keystroke fixes things with style!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding an Escape key shortcut to clear the search input in the Palette UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch palette-search-escape-11726321910484380364

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an Escape-key shortcut to the Web UI search input to improve keyboard navigation by clearing the search and refreshing the entry list.

Changes:

  • Added Escape key handling on the search input to clear/blur and refresh entries.
  • Updated .jules/palette.md with an internal “learning/action” note about the Escape-to-clear behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/webui/template.ts Adds an Escape keydown handler to clear search, blur focus, and refresh entries.
.jules/palette.md Adds internal documentation about the Escape-to-clear search UX pattern.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/webui/template.ts
/* ── Bind ── */
el.createType.addEventListener('change',switchCreate);
el.search.addEventListener('input',()=>{if(searchTimer)clearTimeout(searchTimer);searchTimer=setTimeout(()=>{void refreshEntries()},200)});
el.search.addEventListener('keydown',ev=>{if(ev.key==='Escape'){ev.preventDefault();el.search.value='';el.search.blur();void refreshEntries();}});
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Escape handler, consider clearing any pending searchTimer timeout (and resetting it to null) before calling refreshEntries(). Otherwise a previously scheduled debounce from the input handler can still fire after Escape, causing redundant refreshes and extra API calls/rendering.

Suggested change
el.search.addEventListener('keydown',ev=>{if(ev.key==='Escape'){ev.preventDefault();el.search.value='';el.search.blur();void refreshEntries();}});
el.search.addEventListener('keydown',ev=>{if(ev.key==='Escape'){ev.preventDefault();if(searchTimer){clearTimeout(searchTimer);searchTimer=null}el.search.value='';el.search.blur();void refreshEntries();}});

Copilot uses AI. Check for mistakes.
Comment thread .jules/palette.md
Comment on lines +20 to +23

## 2024-03-21 - Escape Key to Clear Search Context
**Learning:** Implementing an `Escape` key listener to clear input fields like search boxes drastically improves keyboard navigability, but the interaction must comprehensively handle clearing the value, blurring the focus, and resetting the underlying data model view.
**Action:** When adding `Escape` shortcut interactions to inputs, always ensure the event is captured specifically on that input via `keydown`, prevents default behavior, unfocuses the element via `blur()`, and explicitly triggers any necessary state refreshes (e.g., `refreshEntries()`).
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo has a documented convention to avoid committing generated/internal .jules/* artifacts in merged PR changes (see CHANGELOG.md entry for 0.1.2). Please remove this .jules/palette.md change from the PR (or add the appropriate ignore rule and ensure these files aren’t tracked).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/webui/template.ts (1)

1082-1082: Clear pending debounce timer before Escape-triggered refresh.

At Line 1082, the immediate refresh can run alongside a previously scheduled debounce from Line 1081, causing duplicate refresh calls. Consider canceling searchTimer first.

♻️ Proposed tweak
-    el.search.addEventListener('keydown',ev=>{if(ev.key==='Escape'){ev.preventDefault();el.search.value='';el.search.blur();void refreshEntries();}});
+    el.search.addEventListener('keydown',ev=>{
+      if(ev.key==='Escape'){
+        ev.preventDefault();
+        if(searchTimer){clearTimeout(searchTimer);searchTimer=null;}
+        el.search.value='';
+        el.search.blur();
+        void refreshEntries();
+      }
+    });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/webui/template.ts` at line 1082, The Escape key handler on el.search
should clear any pending debounce before calling the immediate refresh to avoid
duplicate refreshes; modify the handler in which ev.key === 'Escape' to call
clearTimeout(searchTimer) (and reset searchTimer to null/undefined) before
setting el.search.value=''/blur() and invoking refreshEntries(), keeping the
existing ev.preventDefault() behavior so the pending debounce cannot also fire.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/webui/template.ts`:
- Line 1082: The Escape key handler on el.search should clear any pending
debounce before calling the immediate refresh to avoid duplicate refreshes;
modify the handler in which ev.key === 'Escape' to call
clearTimeout(searchTimer) (and reset searchTimer to null/undefined) before
setting el.search.value=''/blur() and invoking refreshEntries(), keeping the
existing ev.preventDefault() behavior so the pending debounce cannot also fire.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7791e85e-82ac-4125-bd00-8ea414161eee

📥 Commits

Reviewing files that changed from the base of the PR and between 1cdcca9 and 4c69a29.

📒 Files selected for processing (2)
  • .jules/palette.md
  • src/webui/template.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants