binary-control-name-present

Binary controls have an accessible name

automaticWCAG 4.1.2 (A)confidence: highseverity: seriousrobust

Checks that checkbox, radio, and switch controls expose a non-empty accessible name.

Applies to. Applies to elements carrying role="checkbox", role="radio" or role="switch" (the attribute must name one of those roles alone, not a fallback list) that are included in the accessibility tree. A native <input type="checkbox">/<input type="radio"> is in scope only when it carries one of those roles explicitly; without a role attribute it belongs to form-control-programmatic-label-present.

Expectation. The control has a non-empty accessible name from aria-label, from an aria-labelledby that resolves to non-empty text, or from title. A native checkbox or radio additionally accepts an associated <label>, the labels API, a wrapping <label>, or label[for], with at most four labels read for determinism, and any other element accepts its own subtree text, those roles being name-from-content.

Examples

pass
<div role="switch" tabindex="0" aria-checked="false" aria-label="Bluetooth"></div>

`aria-label` gives the switch an accessible name.

fail
<div role="switch" tabindex="0" aria-checked="false"></div>

The switch has no name from any supported mechanism.

View source