Skip to content

Conversation

@ZeeshanTamboli
Copy link
Member

Closes #23216

Adds role="switch" to the input element to improve accessibility.

Tested with NVDA—now announces "on/off" instead of "checked/unchecked".

@ZeeshanTamboli ZeeshanTamboli added accessibility a11y scope: switch Changes related to the switch. labels Jul 3, 2025
@mui-bot
Copy link

mui-bot commented Jul 3, 2025

Netlify deploy preview

Bundle size report

Bundle Parsed Size Gzip Size
@mui/material 🔺+22B(0.00%) 🔺+10B(+0.01%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against c2b4f83

@ZeeshanTamboli ZeeshanTamboli merged commit 04b87f3 into mui:master Jul 4, 2025
23 checks passed
@ZeeshanTamboli ZeeshanTamboli deleted the issue-23216-add-role-switch branch July 4, 2025 13:43
yafeng-c pushed a commit to yafeng-c/material-ui that referenced this pull request Jul 5, 2025
[Switch] Add role="switch" (mui#46482)

fix again

update new tests
@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 10, 2025

To note that this change breaks tests like:

screen.getByRole('checkbox', { name: 'Pivot' });

https://github.com/mui/mui-x/blob/0a432d357613b0785c32aacf9414fa2cbf240d3b/packages/x-data-grid-premium/src/tests/pivoting.DataGridPremium.test.tsx#L163

that depends on being a specific role.

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

Labels

accessibility a11y scope: switch Changes related to the switch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Switch] Use role="switch"

4 participants