Skip to content

QuizNot attempted

Grouping radio buttons

How should a group of radio buttons ("Account type: Personal / Business") be marked up?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • <fieldset> with a <legend>, each radio inside its own <label>
  • <fieldset> + <legend> gives the group a name announced when focus enters ('Account type, Personal, radio button 1 of 2'), and each radio needs its own <label>
  • sharing a name gives native arrow-key navigation.
  • Not a div with a heading: the heading isn't associated with the group.
  • Not a select: a different control, not markup for radios.
  • Not ul role=radiogroup with no labels: the role names nothing and the radios have no accessible names.