WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Visual labels appears in the Dome after the formcontrol

for

From: Steve Green
Date: Nov 4, 2023 1:36PM


It's not a violation of SC 1.3.2 because the meaning of the content is not affected by the order of the form controls and labels.

As long as the form controls are programmatically associated with the text labels, there is no reason why screen readers cannot announce their name when navigating in browse mode. It's not the website author's fault if the screen reader vendors choose not to make their products do so.

This raises an interesting issue. If the form controls and labels are associated by means of "for" and "id" attributes, the names of the form controls are not announced in browse mode. However, if the form controls get their accessible names from "aria-label" attributes, the names are announced in browse mode.

Would it therefore be considered a "good" or even "best" practice to use both the "for" and "id" attributes (so clicking the label puts the focus in the form control) as well as an "aria-label" attribute that is identical to the visible text? Then the order of the form control and label would not matter.

I know it potentially introduces a maintenance issue if the visible label is changed because the "aria-label" attribute must also be changed, but are there any other reasons for not doing this? And I know it breaks rule 1 of ARIA (don't use ARIA), but it wouldn't be necessary if screen readers behaved better.

Steve Green
Managing Director
Test Partners Ltd