[Switch] Add role="switch" by ZeeshanTamboli · Pull Request #46482 · mui/material-ui (original) (raw)
Navigation Menu
Appearance settings
- AI CODE CREATION
* GitHub CopilotWrite better code with AI
* GitHub Copilot appDirect agents from issue to merge
* MCP RegistryNewIntegrate external tools - DEVELOPER WORKFLOWS
* ActionsAutomate any workflow
* CodespacesInstant dev environments
* IssuesPlan and track work
* Code ReviewManage code changes - APPLICATION SECURITY
* GitHub Advanced SecurityFind and fix vulnerabilities
* Code securitySecure your code as you build
* Secret protectionStop leaks before they start - EXPLORE
* Why GitHub
* Documentation
* Blog
* Changelog
* Marketplace
- AI CODE CREATION
- BY COMPANY SIZE
* Enterprises
* Small and medium teams
* Startups
* Nonprofits - BY USE CASE
* App Modernization
* DevSecOps
* DevOps
* CI/CD
* View all use cases - BY INDUSTRY
* Healthcare
* Financial services
* Manufacturing
* Government
* View all industries
- BY COMPANY SIZE
- EXPLORE BY TOPIC
* AI
* Software Development
* DevOps
* Security
* View all topics - EXPLORE BY TYPE
* Customer stories
* Events & webinars
* Ebooks & reports
* Business insights
* GitHub Skills - SUPPORT & SERVICES
* Documentation
* Customer support
* Community forum
* Trust center
* Partners
- EXPLORE BY TOPIC
- COMMUNITY
* GitHub SponsorsFund open source developers - PROGRAMS
* Security Lab
* Maintainer Community
* Accelerator
* GitHub Stars
* Archive Program - REPOSITORIES
* Topics
* Trending
* Collections
- COMMUNITY
- Pricing
Provide feedback
We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
mui / material-ui Public
Notifications You must be signed in to change notification settings
Additional navigation options
Merged
merged 3 commits into
mui:masterfrom
ZeeshanTamboli:issue-23216-add-role-switch
Jul 4, 2025
ConversationCommits (3)ChecksFiles changed
Merged
[Switch] Add role="switch"#46482
merged 3 commits into
mui:masterfrom
ZeeshanTamboli:issue-23216-add-role-switch
Conversation
ZeeshanTamboli commented
Copy link Copy Markdown
Member
Closes #23216
Adds role="switch" to the input element to improve accessibility.
Tested with NVDA—now announces "on/off" instead of "checked/unchecked".
oliviertassinari reacted with eyes emoji
ZeeshanTamboli added 2 commits
[Add role switch to Switch component](/mui/material-ui/pull/46482/commits/0bc7854bfb21a4f1ed69ff5fd35ad1941b1833a4 "Add role switch to Switch component")
[0bc7854](/mui/material-ui/pull/46482/commits/0bc7854bfb21a4f1ed69ff5fd35ad1941b1833a4)
[update docs](/mui/material-ui/pull/46482/commits/4f42a8f3a73b366d550f9f354a70db184dff4de8 "update docs")
[4f42a8f](/mui/material-ui/pull/46482/commits/4f42a8f3a73b366d550f9f354a70db184dff4de8)
ZeeshanTamboli added accessibility
a11y
Changes related to the switch.
labels
mui-bot commented
•
edited
Loading
Copy link Copy Markdown
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%) |
Generated by 🚫 dangerJS against c2b4f83
[make tests pass](/mui/material-ui/pull/46482/commits/c2b4f83ff1966ddb2c6393d6a27cee27a4379729 "make tests pass")
[c2b4f83](/mui/material-ui/pull/46482/commits/c2b4f83ff1966ddb2c6393d6a27cee27a4379729)
ZeeshanTamboli mentioned this pull request
[Switch][Checkbox][Radio] Remove aria-disabled from root span#46318
Merged
1 task
ZeeshanTamboli requested review fromsai6855 and siriwatknp
sai6855 approved these changes Jul 4, 2025
ZeeshanTamboli merged commit 04b87f3 into mui:master
23 checks passed
ZeeshanTamboli deleted the issue-23216-add-role-switch branch
yafeng-c pushed a commit to yafeng-c/material-ui that referenced this pull request
`[fix and remove redundant tests](/yafeng-c/material-ui/commit/8744a1288e26d488d5c7e058f487881559f0e22b "fix and remove redundant tests
[Switch] Add role="switch" (#46482)
fix again
update new tests") `
[8744a12](/yafeng-c/material-ui/commit/8744a1288e26d488d5c7e058f487881559f0e22b)
[Switch] Add role="switch" (mui#46482)
fix again
update new tests
oliviertassinari commented
•
edited
Loading
Copy link Copy Markdown
Member
To note that this change breaks tests like:
screen.getByRole('checkbox', { name: 'Pivot' });
that depends on being a specific role.
zettca reacted with thumbs up emoji
ZeeshanTamboli mentioned this pull request
[switch] Fix incorrect role with slotProps.input #48469
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
Sign up for free to join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
sai6855 sai6855 approved these changes
siriwatknp Awaiting requested review from siriwatknp
Assignees
No one assigned
Labels
a11y
Changes related to the switch.
Projects
None yet
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.