WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: 2.5.3 Label in name - multi language interface

for

From: glen walker
Date: Feb 14, 2022 6:33PM


Yes.

With regular <label> elements, you basically get that for free (assuming
the label is correctly associated with the <input>) . If the user switches
languages and you change the innerHTML of the <label>, then you'll satisfy
"label in name".

But since you're talking about a search field, you might not have a visible
"Search" label next to the field and instead have aria-label="search".
(Note that you still need some kind of visible "label" for the field but it
could be a magnifying glass icon and doesn't have to be actual text.) When
the user switches languages, the aria-label should be updated to the new
language. Not only will that satisfy 2.5.3 but you also want the new
language to be used when the label is read so you'd have to update the
aria-label anyway, regardless of 2.5.3.