Skip to content
SilktideHelp

Fieldset grouping

Silktide checks that groups of related radio buttons or checkboxes are wrapped in a fieldset. The fieldset tells that the options belong together and form a single question.

In , radio buttons and checkboxes that share the same name attribute act as one group - choose your size, pick your toppings. Visually the grouping is obvious because the options sit together; in the code, only a <fieldset> makes it explicit.

<!-- Problem: related options with nothing grouping them -->
<label><input type="checkbox" name="fruit" value="apple"> Apple</label>
<label><input type="checkbox" name="fruit" value="banana"> Banana</label>

Why this matters

A announces each option as it is reached. Without a group, the listener hears "Apple, checkbox" and "Banana, checkbox" with no indication of what question they answer - the question text may have been read long before, or never associated at all. Wrapped in a fieldset with a legend, each option is announced within its context, so the listener always knows what they are choosing.

How to fix it

Wrap each set of related options in a <fieldset>, and describe the group with a <legend>:

<!-- Fixed: the group is explicit and named -->
<fieldset>
  <legend>Select your favourite fruits</legend>
  <label><input type="checkbox" name="fruit" value="apple"> Apple</label>
  <label><input type="checkbox" name="fruit" value="banana"> Banana</label>
</fieldset>

How Silktide tests this

  1. Find every radio button and checkbox on each page.
  2. Group them by their name attribute.
  3. For each group of two or more, report every member that is not inside a <fieldset> element.

Troubleshooting

My options are grouped another way

This check looks specifically for a <fieldset> ancestor. Groupings expressed only visually, or with other markup such as role="group", are not detected. The fieldset approach is the most widely supported; if you are confident your alternative grouping is announced correctly, you can the finding.

Learn more

Last updated

Was this page helpful?