WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Programmatic relationship between form controls and labels

for

From: Patrick H. Lauke
Date: Nov 5, 2024 4:26AM


My take here would be:

1.3.1 isn't as cut and dry as that. It doesn't necessarily require the
programmatic association, only that if something is presented visually,
the same information is also available programmatically. The point of
defining the relationship in the case of labels and form controls is
primarily to make sure the form control is, as a result, given an
appropriate accessible name (otherwise it'd fail both 1.3.1 and 4.1.2).
If the same relationship ("this text box is for 'Search'") is provided
in a different way, but the end result is still correct, then it doesn't
pose any barriers/problems to users, so I'd say that this is all
passing? (Same if the text box used, say, aria-label="Search")

Yes, I can already hear the argument about "but if it's marked up as a
<label> then users can click/tap on the label to set focus to the text
box" ... but that's a nice-to-have, not a requirement (and not having
that is not a failure).

P
--
Patrick H. Lauke

* https://www.splintered.co.uk/
* https://github.com/patrickhlauke
* https://flickr.com/photos/redux/
* https://mastodon.social/@patrick_h_lauke