Conversation
The switch has no visible text, so nameless instances failed axe button-name checks (including entry publish state). Add a label prop, wire names at CP call sites, and keep aria-label fallthrough for addons.
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.
Description of the Problem
ui/Switchrenders arole="switch"button whose only child is a decorative thumb. It had no accessible name unless a call site passedaria-label, so screen readers announced “switch, on” with no indication of what was being toggled.Most CP call sites omitted a name — including the entry published-state toggle. axe-core reported critical
button-nameviolations across several screens. WCAG 2.1 SC 4.1.2.What this PR Does
labelprop onui/Switchthat setsaria-labelaria-label/aria-labelledbyworking for addons; warns in development when none is providedaria-labelledbyfor Revealer when a visibleinput_labelexists so the accessible name matches what’s on screenFixes #15391
How to Reproduce
aria-labeloraria-labelledby. Actual:<button role="switch" aria-checked="…">with no nameSame on
/cp/sites(site enabled) and/cp/roles/create(super user).