Learn Measure Blog About

ARIA input fields do not have accessible names

Users of screen readers and other assistive technologies need information about the behavior and purpose of controls on your web page. Native HTML controls like buttons and radio groups come with that information built in. For custom controls you create, however, you must provide the information with ARIA roles and attributes. (Learn more in the Introduction to ARIA.)

To be announced properly by assistive technologies, both native HTML controls and custom ARIA controls must have accessible names that convey their purpose.

How Lighthouse identifies ARIA inputs without accessible names

Lighthouse flags custom ARIA input fields whose names aren't accessible to assistive technologies:

Lighthouse audit showing custom input elements without accessible names

Elements that have any of the following ARIA roles but don't have accessible names will cause this audit to fail:

This audit is similar to the Not all ARIA toggle fields have accessible names audit but checks a different set of ARIA roles.

Caution: Most common input types can be created with native HTML elements, which come with built-in behaviors and accessible semantics that can be time consuming to replicate. Consider using native elements instead of ARIA roles if possible.

The Lighthouse Accessibility score is a weighted average of all the accessibility audits. See the Lighthouse accessibility scoring post for more information.

How to add accessible names to your custom ARIA input fields

The easiest way to provide an accessible name for most elements is to include text content in the element. However, custom input fields typically don't have inner text, so you can use one of two strategies instead.

Option 1: Add an aria-label attribute to the element

Use the aria-label attribute to define the name for the current element.

For example, this custom combobox will be announced as "country" to assistive technology users:

<div id="combo1" aria-label="country" role="combobox">England</div>

Option 2: Refer to another element using aria-labelledby

Use the aria-labelledby attribute to identify another element, using its ID, to serve as the name for the current element.

For example, this custom searchbox refers to the searchLabel paragraph as its label and will be announced as "Search currency pairs":

<p id="searchLabel">Search currency pairs:</p>
<div id="search"
role="searchbox"
contenteditable="true"
aria-labelledby="searchLabel">
</div>

Resources

Last updated: Improve article