Conversation
germanocaumo
suggested changes
Oct 1, 2026
germanocaumo
reviewed
Oct 1, 2026
The aria-label/aria-labelledby/aria-describedby props are passed to the MUI Switch root, which forwards them to the ButtonBase span instead of the <input>. The input is then named by the <label htmlFor> that wraps both the title and the helper text, so its accessible name contains both texts and it has no description. MUI's Switch also renders a plain checkbox, so screen readers announce "checkbox" instead of "switch". Pass the aria attributes and role="switch" through slotProps.input so they land on the <input>, merging any slotProps.input supplied by the consumer (object or function form). Since aria-labelledby takes precedence over the native <label> in the accessible name computation, the name becomes the title only and the helper text becomes the description. The <label htmlFor> keeps wrapping both texts, so clicking the helper text still toggles the switch; moving the helper text out of the label was discarded because it drops that behavior. slotProps.input is used instead of inputProps because inputProps is deprecated in MUI and removed in v7. MUI does not merge the two (a slotProps.input replaces inputProps entirely), so a consumer's inputProps would be silently dropped; remove it from ToggleProps instead, turning that into a compile error. Merging the legacy prop was discarded because reading it keeps the deprecated API in use. When only helperText is given, nothing provides aria-labelledby, so the <label htmlFor> names the input from the helper text; linking it as aria-describedby too would announce it twice. Link the helper as the description only when ariaLabel, ariaLabelledBy or label provides the name. Switch only forwards slotProps.input to the <input> since MUI 6.4.9 (earlier 6.x releases ignore it, or lack its types and SwitchOwnerState), so raise the @mui/material and @mui/icons-material peer floor to 6.4.9. BREAKING CHANGE: BBBToggle no longer accepts inputProps; use slotProps.input to set attributes on the underlying <input>. The @mui/material and @mui/icons-material peer range is raised to ^6.4.9 || ^7.0.0.
germanocaumo
approved these changes
Oct 1, 2026
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The aria-label/aria-labelledby/aria-describedby props are passed to the MUI Switch root, which forwards them to the ButtonBase span instead of the . The input is then named by the that wraps both the title and the helper text, so its accessible name contains both texts and it has no description. MUI's Switch also renders a plain checkbox, so screen readers announce "checkbox" instead of "switch".
Pass the aria attributes and role="switch" through slotProps.input so they land on the , merging any slotProps.input supplied by the consumer (object or function form). Since aria-labelledby takes precedence over the native in the accessible name computation, the name becomes the title only and the helper text becomes the description. The keeps wrapping both texts, so clicking the helper text still toggles the switch; moving the helper text out of the label was discarded because it drops that behavior.
slotProps.input is used instead of inputProps because inputProps is deprecated in MUI and removed in v7. MUI does not merge the two (a slotProps.input replaces inputProps entirely), so a consumer's inputProps would be silently dropped; remove it from ToggleProps instead, turning that into a compile error. Merging the legacy prop was discarded because reading it keeps the deprecated API in use.
When only helperText is given, nothing provides aria-labelledby, so the names the input from the helper text; linking it as aria-describedby too would announce it twice. Link the helper as the description only when ariaLabel, ariaLabelledBy or label provides the name.
Switch only forwards slotProps.input to the since MUI 6.4.9 (earlier 6.x releases ignore it, or lack its types and
SwitchOwnerState), so raise the @mui/material and @mui/icons-material peer floor to 6.4.9.
BREAKING CHANGE: BBBToggle no longer accepts inputProps; use slotProps.input to set attributes on the underlying . The @mui/material and @mui/icons-material peer range is raised to ^6.4.9 || ^7.0.0.
Closes Issue(s)
Closes #88