Skip to content

🎨 Palette: Enhance keyboard accessibility for custom form controls#71

Merged
dhaatrik merged 1 commit into
mainfrom
palette-custom-control-a11y-16947369824007062841
Apr 3, 2026
Merged

🎨 Palette: Enhance keyboard accessibility for custom form controls#71
dhaatrik merged 1 commit into
mainfrom
palette-custom-control-a11y-16947369824007062841

Conversation

@dhaatrik

@dhaatrik dhaatrik commented Apr 3, 2026

Copy link
Copy Markdown
Owner

What:

  • Replaced className="hidden" with className="sr-only" for native radio inputs in the Checkout Payment Methods component, and used Tailwind's :has() modifier (has-[:focus-visible]:ring-2) on the parent labels.
  • Added role="switch", aria-checked, and explicit focus-visible styles to the Emergency mode toggle.
  • Added role="switch" and aria-checked to the Dark mode toggle in Settings.

Why:
Custom UI controls built with standard elements need specific configuration to remain accessible. Hiding native radio inputs using hidden (or display: none) removes them from the tab order completely. Using sr-only keeps them in the DOM and accessible via keyboard. Similarly, custom toggle switches built with <button> elements require the role="switch" and aria-checked attributes to properly communicate their state to screen readers.

Before:

  • Payment method radio options could not be navigated to using the Tab key.
  • Emergency and Dark mode toggles were announced as standard buttons and their active states were not communicated clearly to assistive technologies.
  • Emergency toggle lacked any focus ring.

After:

  • Payment methods can be navigated and selected entirely with the keyboard.
  • Switches are properly announced as toggle switches and convey their checked status.
  • Consistent focus states across these interactive components.

Accessibility:

  • Ensures screen reader users can interact with payment and settings controls effectively.
  • Ensures keyboard-only users can navigate and activate custom inputs.
  • Logged learning regarding the sr-only and has-[:focus-visible] pattern to .jules/palette.md.

PR created automatically by Jules for task 16947369824007062841 started by @dhaatrik

Co-authored-by: dhaatrik <90041791+dhaatrik@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.

@dhaatrik dhaatrik merged commit 888400b into main Apr 3, 2026
1 check passed
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