fix(material/radio): hide supporting elements from assistive technology#32816
Open
yogeshwaran-c wants to merge 1 commit intoangular:mainfrom
Open
fix(material/radio): hide supporting elements from assistive technology#32816yogeshwaran-c wants to merge 1 commit intoangular:mainfrom
yogeshwaran-c wants to merge 1 commit intoangular:mainfrom
Conversation
Add `aria-hidden="true"` to the touch target, background, and ripple elements inside mat-radio-button. These are purely visual/interaction elements that VoiceOver on macOS incorrectly reads as "group", creating unnecessary navigation stops for screen reader users. Closes angular#32797
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 kind of change does this PR introduce?
Bug fix (accessibility).
What is the current behavior?
VoiceOver on macOS reads the decorative
divelements insidemat-radio-button(touch target, radio circle background, and ripple container) as "group", creating unnecessary navigation stops when using a screen reader to navigate through a radio group. Each radio button results in multiple "group" announcements instead of just the expected radio button label and state.Closes #32797
What is the new behavior?
The three supporting visual elements inside
mat-radio-buttonnow havearia-hidden="true":.mat-mdc-radio-touch-target-- expanded hit area for touch interaction.mdc-radio__background-- visual radio circle (outer/inner circles).mat-radio-ripple-- ripple effect containerThis hides them from the accessibility tree so screen readers only announce the semantically meaningful
<input type="radio">and<label>elements, resulting in one clean navigation stop per radio button.Additional context
This follows the same pattern used by
mat-checkbox, which marks its decorative SVG checkmark witharia-hidden="true"(seecheckbox.htmlline 33 andcheckbox.spec.tsline 61-64).A unit test has been added to verify all three elements have the
aria-hidden="true"attribute.Files changed:
src/material/radio/radio.html-- Addedaria-hidden="true"to 3 decorative elementssrc/material/radio/radio.spec.ts-- Added test verifying aria-hidden attributes