🎨 Palette: Enhance keyboard accessibility for custom form controls#71
Conversation
Co-authored-by: dhaatrik <90041791+dhaatrik@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
What:
className="hidden"withclassName="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.role="switch",aria-checked, and explicitfocus-visiblestyles to the Emergency mode toggle.role="switch"andaria-checkedto 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(ordisplay: none) removes them from the tab order completely. Usingsr-onlykeeps them in the DOM and accessible via keyboard. Similarly, custom toggle switches built with<button>elements require therole="switch"andaria-checkedattributes to properly communicate their state to screen readers.Before:
After:
Accessibility:
sr-onlyandhas-[:focus-visible]pattern to.jules/palette.md.PR created automatically by Jules for task 16947369824007062841 started by @dhaatrik