Search code examples
htmlradio-buttonaccessibilitywai-aria

aria-required in a radio group


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>.

  1. Should I put aria-required on the <fieldset>?
  2. Should I put aria-required on each radio?
  3. Or would you say "there should be no such thing as a mandatory radio group; set a default value so that the radio group can never be in non-selected state"? -- perhaps this is the topic for a separate usability discussion.

Solution

  • 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.