Skip to content
SilktideHelp

Fieldset legends

Silktide checks that every group of form fields declared with a fieldset also includes a legend describing what the group is for. The legend gives the whole group a name, so each option is heard in context.

In , the <fieldset> element groups related form controls - a set of radio buttons, checkboxes, or address fields - and the <legend> element is its caption.

<!-- Problem: the group has no legend -->
<fieldset>
  <label><input type="radio" name="size" value="s"> Small</label>
  <label><input type="radio" name="size" value="l"> Large</label>
</fieldset>

Why this matters

A sighted visitor sees the group's caption right above the options. A user hears each option one at a time, and without a legend just hears "Small" and "Large" with no indication of what is being chosen. The legend is announced when the listener enters the group, so questions like "T-shirt size" reach everyone.

How to fix it

Add a <legend> as the first element inside each <fieldset>, describing the group in a few words:

<!-- Fixed: the legend names the group -->
<fieldset>
  <legend>T-shirt size</legend>
  <label><input type="radio" name="size" value="s"> Small</label>
  <label><input type="radio" name="size" value="l"> Large</label>
</fieldset>

Keep legends short - screen readers may repeat the legend for every field in the group.

How Silktide tests this

  1. Find every <fieldset> element on each page.
  2. Report each one that has no <legend> element as a direct child.

Troubleshooting

My legend exists but is still reported

The <legend> must be a direct child of the <fieldset>. A caption nested inside another element, such as a <div> wrapper, is not recognized as the group's legend - by this check or by .

Learn more

Last updated

Was this page helpful?