Skip to content

🎨 Palette: Add accessible clear buttons to search inputs#91

Open
schmug wants to merge 1 commit into
mainfrom
palette/accessible-clear-buttons-1689024892557736545
Open

🎨 Palette: Add accessible clear buttons to search inputs#91
schmug wants to merge 1 commit into
mainfrom
palette/accessible-clear-buttons-1689024892557736545

Conversation

@schmug
Copy link
Copy Markdown
Owner

@schmug schmug commented May 4, 2026

🎨 Palette: Add Accessible Clear Buttons to Search Inputs

πŸ’‘ What:
Added a "clear" button (an 'X' icon) to the custom search and filter input fields within the ProjectsApp, BlogApp, and Launcher components. The button only appears when there is text to clear.

🎯 Why:
Custom search and filter inputs that use outline-none often break native browser accessibility features, like the native clear button. By adding a custom clear button, we make it easier to reset searches. More importantly, simply adding a button isn't enough; we implemented it using a useRef so that when the button is clicked, keyboard focus is immediately returned to the input field. This prevents users who navigate via keyboard from losing their context and having to tab through the DOM again.

β™Ώ Accessibility:

  • The clear button uses type="button" to avoid accidentally submitting parent forms.
  • Added an explicit aria-label="Clear filter" for screen readers.
  • Added focus-visible utility classes to the button to ensure it is easily reachable and distinguishable via keyboard navigation.
  • Focus is managed tightly; clearing the input returns the user directly back to the input field.
  • Documented this pattern in .Jules/palette.md.

PR created automatically by Jules for task 1689024892557736545 started by @schmug

- Added accessible 'clear' buttons (X icon) to custom search/filter inputs in `ProjectsApp`, `BlogApp`, and `Launcher`.
- Utilized `useRef` to maintain keyboard focus context when clearing, preventing users from losing their place in the DOM.
- Kept inputs strictly accessible with `type="button"`, explicit `aria-label`, and `focus-visible` utilities.
- Added a UX/a11y journal entry to `.Jules/palette.md` to document this focus management pattern.

Co-authored-by: schmug <38227427+schmug@users.noreply.github.com>
@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.

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.

1 participant