-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug(MatRadioButton): The required
attribute is used on a radio button
#30399
Labels
Accessibility
This issue is related to accessibility (a11y)
area: material/radio
P2
The issue is important to a large percentage of users, with a workaround
Comments
naaajii
added a commit
to naaajii/components
that referenced
this issue
Feb 2, 2025
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton' to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of `MatRadioGroup` fixes angular#30399
naaajii
added a commit
to naaajii/components
that referenced
this issue
Feb 2, 2025
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton` to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of `MatRadioGroup` fixes angular#30399
naaajii
added a commit
to naaajii/components
that referenced
this issue
Feb 2, 2025
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton` to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of `MatRadioGroup` fixes angular#30399
naaajii
added a commit
to naaajii/components
that referenced
this issue
Feb 3, 2025
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton` to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of `MatRadioGroup` fixes angular#30399
naaajii
added a commit
to naaajii/components
that referenced
this issue
Feb 3, 2025
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton` to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of `MatRadioGroup` fixes angular#30399
naaajii
added a commit
to naaajii/components
that referenced
this issue
Feb 3, 2025
fixes when `MatRadioGroup` is set to be required it was setting all of its `MatRadioButton` to be required as-well which is confusing for assistive technologies, this commit ensures we only set aria-required on group rather than all buttons unless button is being used standalone of `MatRadioGroup` fixes angular#30399
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Accessibility
This issue is related to accessibility (a11y)
area: material/radio
P2
The issue is important to a large percentage of users, with a workaround
Is this a regression?
The previous version in which this bug was not present was
No response
Description
When used in a radio group, the
required
attribute is used on a radio button. All the radio buttons under the group haverequired
attributes. This attribute should not be used on individual radio buttons, because that creates illogical meta-data, which may be confusing for assistive technology users. It's not the individual controls that are required, it's the group as a whole that must have one choice made from it.Code reference: https://source.corp.google.com/piper///depot/google3/third_party/javascript/angular_components/src/material/radio/radio.ts;l=250-257;bpv=1;bpt=1
Reproduction
StackBlitz link:
Steps to reproduce:
1.
2.
Expected Behavior
When a radio button is used inside a radio group, if the group is required and does not have a default selection, then add
aria-required="true"
to the wrapping element, notaria-required/required
to the individual controls. We can leave it unchanged when a radio button is used outside a radio group, though I am unsure if that is a valid use case.Actual Behavior
The
required
attribute is applied to each radio button in a group.Environment
The text was updated successfully, but these errors were encountered: