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 6:42PM


Ø FYI the list of labelable elements in HTML5 includes - button <http://www.w3.org/TR/html5/forms.html#the-button-element>;



WCAG Technique H44<https://www.w3.org/TR/2015/NOTE-WCAG20-TECHS-20150226/H44> states:



Note 2: The label element is not used for the following because labels for these elements are provided via the value attribute (for Submit and Reset buttons), the alt attribute (for image buttons), or element content itself (button).



'Submit and Reset buttons ( input type="submit" or input type="reset")

'Image buttons ( input type="image")

'Hidden input fields ( input type="hidden")

'Script buttons (button elements or <input type="button">)



HTML Accessibility API Mappings 1.0<https://www.w3.org/TR/html-aam-1.0/#button-element> also indicates the following which does not seem to include the label element:

5.4 button Element
5.4.1 button Element Accessible Name Calculation

1. If the button element has an aria-label<http://www.w3.org/TR/wai-aria-1.1/#aria-label>; or an aria-labelledby<http://www.w3.org/TR/wai-aria-1.1/#aria-labelledby>; attribute the accessible name<https://www.w3.org/TR/html-aam-1.0/#dfn-accessible-name> is to be calculated using the algorithm defined in Accessible Name and Description: Computation and API Mappings 1.1<http://rawgit.com/w3c/aria/master/accname-aam/accname-aam.html>;.
2. Otherwise use the button element subtree
3. Otherwise use title attribute
4. If none of the above yield a usable text string there is no accessible name<https://www.w3.org/TR/html-aam-1.0/#dfn-accessible-name>



Jonathan