WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: Question about search form label

for

From: glen walker
Date: Sep 13, 2023 6:37PM


Sounds like a 3.3.2 issue. A placeholder is not a label because, as you
said, it disappears when you type. And providing an aria-label, while
providing an accessible name, is only available to some assistive
technology users.

The label for the search field doesn't have to be a text label. It can be a
magnifying glass, as long as the icon has alt text. The definition of
"label" in 3.3.2 is part of the normative definition,
https://www.w3.org/TR/WCAG21/#dfn-labels, and says, "text or *other
component *with a text alternative that is presented to a user to identify
a component within Web content". The "other component" can be an icon.

I like the "floating label" concept,
https://bradfrost.com/blog/post/float-label-pattern/