WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Using <legend> and <fieldset> on a single drop-down.

for

From: Mark Magennis
Date: May 28, 2021 4:22AM


Hi Ksenia,

A fieldset is just a group of related fields that have a group name in addition to their individual names. So if your language dropdown is in a group of related controls then a group name might be sensible. The fieldset can have only one field in it if the group has a variable number of items in it but sometimes only one. E.g. "Color. Checkbox Red". Red is the field label and Color is the group label. But in this case there is only one color available so the group contains only one item. At other times it may also contain checkboxes for Blue, Yellow, etc.

But the group name (legend) would need to be in a group (fieldset) that it names, otherwise it doesn't name anything.

Mark