Rampsight

All rules

ARIA

ARIA input fields need a name

Why it matters

A combobox, listbox or searchbox built from generic elements has no label of its own. Without a name it is announced by its role alone, so its purpose is invisible to anyone not looking at the screen.

How to fix it

  1. Point aria-labelledby at the visible label element.
  2. Where there is no visible label, use aria-label with the same wording the placeholder shows.
  3. A placeholder alone is not a name: it disappears as soon as someone types.

In markup

Fails
<div role="combobox" aria-expanded="false"></div>
Passes
<div role="combobox" aria-expanded="false" aria-label="Country"></div>

The requirement behind it

This rule is one way of failing the following WCAG 2.2 success criteria. The W3C, which writes the standard, explains each of them:

Further reading

Deque University on aria-input-field-name (opens in new tab)

Deque maintains axe-core, the open-source engine our scanner runs. Their page documents the rule as the engine implements it.

Automated checks find failures a browser can prove. They cannot judge whether a caption is accurate, whether an alt text is useful, or whether a page can be operated end to end with a keyboard — those need a person.