ARIA toggle fields must have an accessible name

Custom toggles built with ARIA roles, such as switch, checkbox, radio, option and menu item checkboxes or radios, need an accessible name, so users know what they turn on or off.

Rule IDaria-toggle-field-name
ImpactSerious
Success criterion 4.1.2 Name, Role, Value · A
StandardsWCAG 2.0 · WCAG 2.1 · WCAG 2.2 · Section 508 · EN 301 549
Readabler fix Fixed with a text: from the page or written by AI

Example

Before
<p>Email me about new arrivals</p>
<div role="switch" aria-checked="false" tabindex="0"></div>

A screen reader says “switch, off” and nothing more, so users cannot tell what it controls.

After
<p id="news-label">Email me about new arrivals</p>
<div role="switch" aria-checked="false" tabindex="0" aria-labelledby="news-label"></div>

A screen reader says “Email me about new arrivals, switch, off”.

Why it matters

A toggle without a name gives users a state but no subject: “on”, “off”, “checked”, with nothing to say what is on or checked. Blind users must guess from surrounding text, which their screen reader may not read at the same time. In settings pages with many switches, every one sounds the same.

Voice control users are affected too. They operate controls by saying their name, such as “click Dark mode”, and an unnamed switch cannot be targeted. A visible text next to the toggle does not help on its own: a native <label> cannot be linked to a <div>, so the connection has to be made with ARIA. This fails WCAG 4.1.2, which requires every control to have a name.

How to fix it

Use native inputs when you can. An <input type="checkbox"> with a <label> gets its name for free, and you can style it as a switch with role="switch":

<input type="checkbox" role="switch" id="dark-mode">
<label for="dark-mode">Dark mode</label>

Visible label nearby. Give the text an id and reference it with aria-labelledby, as in the example above. Note that <label for> does not work with a <div> or <span>.

Text inside the toggle. Text content names checkbox, radio, option and menu item roles automatically:

<li role="option" aria-selected="false">Express delivery</li>

A switch is named from its content too, but switches are often empty, so check.

No visible text. Use aria-label, and consider adding visible text for people who do not use a screen reader.

Avoid title as the only name. It counts for the check, but touch and keyboard users never see it.

Checklist

  1. Prefer native checkboxes and radios with a label.
  2. Link visible text to custom toggles with aria-labelledby.
  3. Use aria-label only when no visible text exists.
  4. Make sure every switch in a list has a distinct name.

How the check works

The check looks at elements with the roles checkbox, menuitemcheckbox, menuitemradio, radio, switch or option, excluding native form controls. It passes when the element has visible text, a non-empty aria-label, an aria-labelledby that points to text, or a non-empty title. It fails when no name is found and no <label> is attached. If a label exists but is not part of the computed name, the result needs review.

Resources

Updated October 27, 2026