WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Hiding Legends


From: Jared Smith
Date: Oct 15, 2008 7:50PM

On Wed, Oct 15, 2008 at 6:43 PM, Dean Hamack < <EMAIL REMOVED> > wrote:
> If that's the case, I can definitely see the need to
> hide legends. Do you have an example of how you've used it with groups of
> radio buttons?

Here's a basic example:

Is accessibility cool?

* Yes
* No

In this case, the form elements and labels do not make sense alone
without the accompanying legend ("Is accessibility cool?"). I think
you'll notice that this is the case for almost all radio buttons and
most groups of check boxes. As before, the legend should not be hidden
in this or nearly any other case.

There are several other instances of this, with accompanying code, at

There are a few cases where grouped radio buttons or check boxes
wouldn't need a fieldset/legend, but only when the individual elements
make very clear sense without them. Radio buttons for gender, for
example, would not necessarily require a legend.

Am I understanding correctly that you are simply doing an image
replacement for a graphical label? In other words, you have a graphic
from the design people that you're trying to put into the label? If
this is the case, why not just put the image in the legend and give it
appropriate alt text? This would certainly be easier, better, and more
semantically appropriate than doing complex image replacement.

Jared Smith