WebAIM - Web Accessibility In Mind

E-mail List Archives

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

for

From: Sailesh Panchang
Date: Feb 22, 2016 10:15AM


The HTML5 specs say, "button element represents a button labeled by
its contents". So a button element or an input element of pushbutton
type do not need or use for-id method for label association.
Also see https://www.w3.org/TR/WCAG20-TECHS/H91.html

With regard to Detlev ' s question:
The for-id method is only meant for form controls other than buttons really.
It can be used for controls with readonly attribute too. Sure it will
not move focus because the control is readonly but the label
association is available to screen readers.
I have seen label for-id incorrectly being used in non-editable mode
when the content is displayed for, say confirmation of data already
entered.
So the data is displayed in a 2-col format with label on the left and
the data to its right. This is plain static text and the label text is
marked up as a label and the plain text to its right has an id that
points to the label! This does not expose any info relationship as
intended by the author. The content needs to be marked up as a 2-col
data table with row headers or as a dl-dt-dd to expose data
relationships and pass SC 1.3.1.
Thanks and regards,
Sailesh Panchang