Robust · 4.1 Compatible

Name, Role, Value WCAG 4.1.2 · Level A

For all user interface components, including form controls, links, and custom scripted widgets, the name and role must be programmatically determinable, user-settable states, properties, and values must be programmatically settable, and changes to them must be exposed to assistive technologies.

Level
A
Since
WCAG 2.0
Principle
Robust
Guideline
4.1 Compatible

Live demo

Tab through the order preferences

The same task, done two ways: switch between the version that passes and the one that fails, or put them side by side. Everything in the box is live, so try it with a keyboard, a pointer or a screen reader.

Tab through each version: press Space on the order email option and Enter on Delivery options. Then compare what the screen reader preview says for each control.

Live example

Passes

Order preferences

What happened

    Why it passes

    A real checkbox is announced as a checkbox with its checked state, and Space changes it. Delivery options says whether its section is expanded or collapsed.

    Why it fails

    The order email option is a styled div: a screen reader hears plain text, not a checkbox, and Space does nothing. Delivery options opens its section but never says whether it is open.

    Examples

    Code that fails, and the fix

    Four examples, each one running: the usual ways this criterion fails, and code that passes. Listen to them, measure them, or copy the code.

    01

    Fails

    Custom checkbox built from a span

    Live preview

    HTML
    <span class="checkbox is-checked" tabindex="0"      onclick="this.classList.toggle('is-checked')">Keep me signed in</span>

    It looks checked and changes when clicked, but assistive technology gets no checkbox role and no checked state, so a screen reader reads it as plain text.

    Passes

    Switch that exposes its role and state

    Live preview

    HTML
    <button type="button" role="switch" aria-checked="true" id="remember">Keep me signed in</button><script>  const toggle = document.getElementById("remember");  toggle.addEventListener("click", () => {    const on = toggle.getAttribute("aria-checked") === "true";    toggle.setAttribute("aria-checked", String(!on));  });</script>

    role="switch" gives the role, the text gives the name, and aria-checked changes on every press, so screen readers announce on or off. A native checkbox does the same with no script.

    Fails

    Accordion button with no expanded state

    Live preview

    HTML
    <button type="button" class="accordion">Delivery options</button><div class="accordion-panel" hidden>  <p>Standard delivery takes three to five working days.</p></div>

    Script shows and hides the panel, but the button never exposes aria-expanded, so a screen reader user cannot tell whether the section is open.

    Passes

    Keeping aria-expanded in step

    Live preview

    JavaScript
    const button = document.querySelector(".accordion");const panel = document.querySelector(".accordion-panel");button.setAttribute("aria-expanded", "false");button.addEventListener("click", () => {  const open = button.getAttribute("aria-expanded") === "true";  button.setAttribute("aria-expanded", String(!open));  panel.hidden = open;});

    The button's state changes together with the panel, so a screen reader says expanded or collapsed each time it is pressed.

    Why it matters

    Who it helps

    Screen reader, voice control, and switch users depend on assistive technology knowing what each control is, what it is called, and what state it is in. Without this, custom buttons, toggles, and menus are unusable or misleading.

    W3C: Understanding 4.1.2
    • Level A

      Level A is the minimum: failing it can shut some people out completely.

    • In WCAG versions

      Part of WCAG 2.0 since December 2008, and of every version after it.

      WCAG 1.0 checkpoints: 6.2, 8.1, 12.1, 12.4

    • Where it is required

      Required where the law names WCAG 2.0 or later at this level: the United States, Canada, the European Union, the United Kingdom, France, Germany, Italy, Spain, the Netherlands, Ireland, Norway, Switzerland, India, Japan, Australia, New Zealand and Israel.

    How to test

    Checking it

    A few concrete steps. Automated tools find some failures; most need a person.

    1. Use an accessibility inspector or screen reader to check each interactive element's name, role, and current state.
    2. Operate custom widgets such as toggles, tabs, accordions, and menus, and confirm state changes like expanded or checked are announced.
    3. Confirm icon-only buttons and links have meaningful accessible names.

    Common failures

    Where it breaks

    • A clickable div or span is used as a button but exposes no button role or accessible name.
    • An icon-only button has no text, aria-label, or other accessible name.
    • A custom checkbox or accordion changes visually but does not update aria-checked or aria-expanded.