Skip to content

fix(material/radio): required attribute being set on buttons #31163

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewseguin
Copy link
Contributor

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 #30399

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
@andrewseguin andrewseguin requested a review from a team as a code owner May 20, 2025 18:09
@andrewseguin andrewseguin requested review from adolgachev and crisbeto and removed request for a team May 20, 2025 18:09
// we never want to set required attribute on input when we have MatRadioGroup as we will set
// aria-required directly on MatRadioGroup if its required as setting on all MatRadioButton for
// it's MatRadioGroup would be confusing for assistive technology.
if (this.radioGroup) return null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this null instead of false, but when we're setting it according to this.required we don't do || null? Is there a difference between aria-required="false" and just not having the attribute?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(MatRadioButton): The required attribute is used on a radio button
3 participants