WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Label for a set of radio buttons

for

From: Jukka K. Korpela
Date: Jun 10, 2013 3:08PM


2013-06-10 23:57, Dave Merrill wrote:

> From an accessibility point of view, how are you supposed
> to label a set of radio buttons?

You aren't.

> The 'for' attribute of a <label> tag has
> to point to a single control (not a fieldset),

Exactly.

> and label tags can surround
> only one field (not to mention the fact that the label isn't always
> adjacent to the actual field).

A label element can be associated with a single control (input field).

> One answer is a separate label for each radio, which in some sense you need
> anyway to explain it,

Yes, and that's what the label element is for.

> but how then do you tie them together, and to the
> question being asked?

Any way you like, or no way. Normally, when there is a question followed
by alternative answers, the situation is pretty clear. You can wrap the
radio buttons inside a fieldset element, and use the legend element for
it. You could put the question in the legend, or make it a heading
element, or just a paragraph (p element). But this has no crucial
impact, and it has nothing to do with labelling things.

Yucca