WebAIM - Web Accessibility In Mind

E-mail List Archives

Can aria-labelledby refer to a label?

for

From: Birkir R. Gunnarsson
Date: Jul 2, 2013 1:34PM


Greetings gang.

I am looking at a webpage and came across an interesting problem.
Imagine there are two radio buttons.
Each button is properly labeled.
Whichever option you choose, you are required to enter additional text
into an input field.
The label of the radio button also works perfectly as the label for
the input field.
Now, what if we assigned the label for each radio button its own id.
<label id="foo" for "bar">Some text</label>
<input type="radio" id="bar" value="something">
.. and associate the same label to the text input field that has to be
used if user selects this button
<input type="text" value="" size="20" aria-labelledby="foo">

Just curious if anyone has tried or used this approach, or, if for
some reason, it is safer to create a label separately for the input
text field.
(I know aria-labelledby is not yet universally supported across A.T.s
which is a problem. I also have never assigned a unique ID to a label,
but my Googling indicates that is not a problem).

Cheers
-B

Birkir Gunnarsson
Accessibility subject matter expert | Deque Systems