-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[base-ui][Switch] Missing accessibility features #40615
Comments
@michaldudak I discovered these while preparing a demo of why I think the hooks are a great pattern for Base UI (instead of one component per node). I'm spending some time on Friday on this, so I can take this issue at that time as well. |
We need the design to specify first what behavior we're looking for. There's no clear answer:
Radix seems to follow the last example: https://www.radix-ui.com/primitives/docs/components/switch. React Aria components seem to follow none 😅 Going on a tangent from now forward...@michaldudak @colmtuite @mj12albert: it's clearer to me by the day that:
|
According to the ARIA spec, the |
Then we're missing both, right? It doesn't seem right not to have the role "A switch provides approximately the same functionality as a checkbox and toggle button, but makes it possible for assistive technologies to present the widget in a fashion consistent with its on-screen appearance." |
Yes, we should add both. |
@DiegoAndai Hey! Can I pick this up & make the change? |
@DiegoAndai We can close this issue as the changes are now merged |
Steps to reproduce
Link to live example: https://mui.com/base-ui/react-switch/#introduction
Current behavior
The
Switch
component anduseSwitch
hook are missing some important accessibility features:switch
aria-checked
attributeEnter
key should toggle the switchExpected behavior
For the component and hook to comply with the authoring practices.
Benchmarks
Your environment
npx @mui/envinfo
Search keywords: base-ui switch accessibility
The text was updated successfully, but these errors were encountered: