From 0bc7854bfb21a4f1ed69ff5fd35ad1941b1833a4 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Thu, 3 Jul 2025 18:43:30 +0530 Subject: [PATCH 1/3] Add role switch to Switch component --- packages/mui-material/src/Switch/Switch.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/mui-material/src/Switch/Switch.js b/packages/mui-material/src/Switch/Switch.js index b882fbc50cb0f2..d7ad8b8790b043 100644 --- a/packages/mui-material/src/Switch/Switch.js +++ b/packages/mui-material/src/Switch/Switch.js @@ -300,6 +300,9 @@ const Switch = React.forwardRef(function Switch(inProps, ref) { input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input, }), + input: { + role: 'switch', + }, }} /> From 4f42a8f3a73b366d550f9f354a70db184dff4de8 Mon Sep 17 00:00:00 2001 From: ZeeshanTamboli Date: Thu, 3 Jul 2025 19:11:01 +0530 Subject: [PATCH 2/3] update docs --- docs/data/material/components/switches/switches.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/data/material/components/switches/switches.md b/docs/data/material/components/switches/switches.md index f64ca8f1aceeff..5a00651b17db63 100644 --- a/docs/data/material/components/switches/switches.md +++ b/docs/data/material/components/switches/switches.md @@ -71,10 +71,6 @@ You can change the placement of the label: ## Accessibility -- It will render an element with the `checkbox` role not `switch` role since this - role isn't widely supported yet. Please test first if assistive technology of your - target audience supports this role properly. Then you can change the role with - `` - All form controls should have labels, and this includes radio buttons, checkboxes, and switches. In most cases, this is done by using the `