WebAIM - Web Accessibility In Mind

E-mail List Archives

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

for

From: Mallory
Date: May 29, 2021 3:48AM


Graham wrote:

> One other thing that I have found in the past is that the <legend> element
> needs to be the first child element of the <fieldset> or not all screen
> readers will announce it. But I must admit that I haven't tested that for a
> couple of years so that may no longer be the case.

It's based on the browser and yeah, it's still the case for some.
There's a github issue open for the WHATWG HTML spec where someone asks whether two separate parts of the spec are maybe slightly contradictory on this, but as far as behaviour... you can only be assured a user agent will name the group if the legend is the first direct child.

cheers,
_mallory