Fix/radio aria hidden decorative elements#32811
Open
shivdev277 wants to merge 10 commits intoangular:mainfrom
Open
Fix/radio aria hidden decorative elements#32811shivdev277 wants to merge 10 commits intoangular:mainfrom
shivdev277 wants to merge 10 commits intoangular:mainfrom
Conversation
- Add new section explaining the usePopover option - Include code examples for basic and advanced usage - List benefits of using the native Popover API - Add browser compatibility note Closes #<issue-number>
- Add new section explaining the usePopover configuration option - Include code examples for basic and advanced usage patterns - List benefits of using the native Popover API - Add browser compatibility notes for older browsers
…e popover/inline insertion)
…els instead of manual popover
…nstead of manual popover
…rlay attach/detach pattern
…n reader accessibility Decorative elements such as .mat-mdc-radio-touch-target, .mdc-radio__background and the MatRipple container (.mat-radio-ripple) were being picked up by VoiceOver and read aloud as empty 'group' elements. This caused multiple unnecessary navigation stops per radio button when using a screen reader. Adding aria-hidden='true' to these purely visual/interactive elements ensures that screen readers only announce the native radio input with its label and checked state, resulting in exactly one navigation stop per radio button. A unit test has been added to verify that all three decorative elements carry aria-hidden='true'.
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
mat-radio-buttonincludes several purely decorative/interactive child elements:.mat-mdc-radio-touch-target— enlarged tap target.mdc-radio__background— visual outer/inner circle.mat-radio-ripple(MatRipple container) — ripple animationThese
<div>elements were not hidden from the accessibility tree. VoiceOver (macOS)traverses them and announces each one as an empty "group", causing multiple
unnecessary navigation stops per radio button. Users navigating via screen reader
expect exactly one stop per option (label + checked/unchecked state).
Fix
Added
aria-hidden="true"to all three decorative elements inradio.html.This matches the existing pattern already applied in
checkbox.html(the SVG checkmarkcarries
aria-hidden="true"for the same reason).Testing
radio.spec.tsasserting that.mat-mdc-radio-touch-target,.mdc-radio__background, and.mat-radio-rippleall havearia-hidden="true".navigation stop announcing label and state only.
Files Changed
src/material/radio/radio.htmlaria-hidden="true"to 3 decorative elementssrc/material/radio/radio.spec.tsFixes #<ISSUE_NUMBER>