Accessible Name for ARIA Toggle Fields
Rule ID: aria-toggle-field-name
Ruleset: axe-core 4.10
User Impact: Serious
Guidelines: WCAG 2.1 (A), WCAG 2.0 (A), WCAG 2.2 (A), Trusted Tester, EN 301 549
How to Fix the Problem
ARIA toggle fields—like checkboxes, radio buttons, switches, and menu items—must have accessible names so that assistive technologies can describe them properly to users. This can be done using aria-label
, aria-labelledby
, or visible text that can be programmatically determined.
Below are correct implementations for common roles:
✅ Correct Markup Patterns
1. Checkbox
A visible label (“Newspaper”) is used as the accessible name.
2. Menu Item Checkbox
The aria-label
explicitly provides a name.
3. Menu Item Radio
Uses aria-labelledby
to reference a visible label.
4. Radio
The title
attribute acts as the accessible name.
5. Switch
Here, aria-label
is used for clarity, since the state indicators (“off”/”on”) alone are not sufficient.
Why it Matters
Users who rely on screen readers or other assistive technologies need a clear understanding of each toggle control’s purpose and state. Without accessible names:
-
Controls may be announced as “unlabeled” or “unknown,” which is confusing.
-
Users cannot effectively interact with toggles.
-
It disrupts user flow, increases error rates, and severely hinders accessibility compliance.
Providing accessible names ensures all users, including those with visual impairments, can understand and operate toggle components just as effectively as sighted users.
Rule Description
Every ARIA toggle control—like role="checkbox"
, role="radio"
, or role="switch"
—must have an accessible name. This name may come from visible text or be provided programmatically via ARIA attributes like aria-label
or aria-labelledby
.
The Algorithm (in Simple Terms)
-
Find any element with one of the toggle roles (e.g., checkbox, radio, switch).
-
Check if it has an accessible name from:
-
aria-label
-
aria-labelledby
-
Inner text content
-
title
attribute
-
-
If no accessible name is found, the element fails this rule.