Accessibility Certified – Home

4.1.2 Name, Role, Value

Every interactive element exposes its name, role and current state in code, so assistive technology can present and operate it.

Level APrinciple 4: Robust

What does it mean?

Assistive technology needs to know for each control what it is called (name), what it is (role, for example button, link, checkbox) and what state it is in (for example expanded, selected, checked). Native HTML elements such as <button>, <a href> and <input> provide this automatically.

Custom controls built from <div> or <span>, such as menus, tabs, accordions and toggles, must provide this information through ARIA and update it when the state changes. This applies to all user interface components, including those added by plug-ins or third-party scripts.

Who does it help?

  • Screen reader users, who need to know what a control does and what state it is in
  • Speech control users, who activate controls by name
  • Keyboard users, who depend on real buttons and links to reach controls

Common failures

  • A clickable <div> used as a button with no role, name or keyboard support
  • An icon button without a text alternative, announced only as "button"
  • An accordion or menu that opens visually but does not report "expanded" or "collapsed"
  • A custom toggle switch that does not announce whether it is on or off

How we test it

  • axe-core Automatic: axe-core finds typical violations. A violation is pre-filled as “fails”.

Test question: Custom controls (menus, tabs, accordions, toggles) expose name, role and state to assistive technology. Check with a screen reader.

A person decides every criterion. No criterion ever passes automatically.

How to fix it

Problem
<div class="toggle" onclick="toggleMenu()">Menu</div>
<ul id="menu" hidden>…</ul>
Better
<button type="button" aria-expanded="false" aria-controls="menu">Menu</button>
<ul id="menu" hidden>…</ul>
<script type="module">
  const btn = document.querySelector('[aria-controls="menu"]');
  btn.addEventListener('click', () => {
    const open = btn.getAttribute('aria-expanded') === 'true';
    btn.setAttribute('aria-expanded', String(!open));
    document.getElementById('menu').hidden = open;
  });
</script>

A real button provides name and role, and aria-expanded reports whether the menu is open.

Practical tips

  • Use native HTML elements first; add ARIA only where no native element exists.
  • Check with a screen reader that each control is announced with name, role and state.

Guides and patterns on this

Official source

Understanding WCAG 2.2 at the W3C: 4.1.2 Name, Role, Value

How does your website do on this criterion?

The free check tests your home page automatically; the audit decides all 55 criteria.

Free checkAll criteria