When I have a mandatory (required) radio group, which element(s) should have the aria-required="true"
attribute? Basically, I have a bunch of <input type="radio">
elements that share the same name
and are grouped together under a <fieldset>
.
aria-required
on the <fieldset>
?aria-required
on each radio?The aria-required attribute indicates that user input is required on the element before a form may be submitted.
It can be added to form fields just like aria-required=”true” and it's supposed to alert screen reader users that the field is required. However, where HTML 5 required differs from aria-required=”true” is that HTML 5 required actually has behavior associated with it.
The WAI-ARIA aria-required property indicates that user input is required before submission. The aria-required property can have values of "true" or "false". For example, if a user must fill in an address field, then aria-required is set to "true".
In a tablist, aria-selected is used on a tab to indicate the currently-displayed tabpanel . The selected tab in a tablist should have has its aria-selected="true" set. All inactive tabs in the tablist should have aria-selected="false" set.
As a screen reader user I would suggest option one or three. I don’t want to hear my screen reader announce “required” every time I change the selection on a radio button. If I’m going through the effort to view the different options having “required” announced on each one will get repetitive quickly. I’d like to have the required attribute on the fieldset element so I know it’s a section of the form that does need to be filled out.
From a usability perspective I prefer to have a default selection since if I see a default I usually skip to the next section of the form assuming the default isn’t obviously wrong. Whether you feel comfortable with providing the user a default choice and not forcing them to make a selection would depend on the importance of the information your application requires and the consequences if that information is wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With