Skip to content

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?

@adolgachev adolgachev removed their request for review July 21, 2025 22:41
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