WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: using "label for=" on things other than inputs

for

From: Jonathan Avila
Date: Feb 19, 2016 12:15PM


> (B) Whether this unintended use of label for="" would violate 4.1.2 or is actually harmless

In my opinion it depends on whether the information and relationship is communicated another way or whether it is necessary information or relationship. If a label is used incorrectly to associate text with a button but the text is not necessary to understand the purpose of the button then it does not seem to be a failure. However, if the information is necessary to understand the purpose of the control then it must be associated somehow with the control and thus if it were not it could be a failure of SC 1.3.1. Use of a label on a button doesn't seem to be a failure under SC 4.1.1.

Jonathan

Jonathan Avila
Chief Accessibility Officer
SSB BART Group
<EMAIL REMOVED>
703.637.8957 (o)
Follow us: Facebook | Twitter | LinkedIn | Blog | Newsletter


-----Original Message-----
From: WebAIM-Forum [mailto: <EMAIL REMOVED> ] On Behalf Of Detlev Fischer
Sent: Friday, February 19, 2016 1:56 AM
To: WebAIM Discussion List
Subject: [WebAIM] using "label for=" on things other than inputs

Short question: When checking forms for a11y, I often see that 'label' with an explicit association via the 'for' attribute is used on things other than input elements. For example, on a button that will add a user via a pseudo popup dialog, or on text that is read-only because a user may not have permission to input data at this point.
The label does not activate the button so using it does not extend the click area for mouse users as is the case with checkboxes or radio buttons. The proper label of the button is of course given via the value of the button (or link text of links made to look like buttons).

So the question I have come up with is whether
(A) I should dissuade developers from using label on content that is not suitable
as a labeled control even though the use may be harmless
(B) Whether this unintended use of label for="" would violate 4.1.2 or is actually harmless

One reason for using label for developers is of course that they can apply the same styling to label elements regardless of whether they are labels of inputs or labels of other stuff that is not an input (read-only content, buttons etc.). There can also be different variants of a form where depending on the rights of the user an element may be a proper input or read-only content, so it is probably unreasonable to expect developers to create different variants of the same form mark-up depending on permission rights.


--
Detlev Fischer
testkreis - das Accessibility-Team von feld.wald.wiese c/o feld.wald.wiese Thedestraße 2
22767 Hamburg

Mobil +49 (0)157 57 57 57 45
Fax +49 (0)40 439 10 68-5

http://www.testkreis.de
Beratung, Tests und Schulungen für barrierefreie Websites