WCAG 2.2 - Success Criterion
4.1.2 Name, Role, Value
Description
For all user interface components - including form elements, links, and custom widgets created with scripting - the following must be programmatically determinable or settable: the name and role of the component, and any states, properties, and values that can be set by the user. This criterion ensures that assistive technologies such as screen readers can identify what a component is (its role), what it is called (its name), and what state it is in (e.g., expanded, selected, checked). It is the foundation of accessible rich internet applications and applies to every interactive element on a page.
How To Test
- Using browser developer tools or an accessibility tree inspector (e.g., Firefox Accessibility panel), examine every interactive element on the page.
- Confirm each element has a non-empty accessible name (visible label,
aria-label,aria-labelledby, oralttext for images). - Confirm each element has an appropriate role - either from native HTML semantics (button, link, checkbox) or an explicit
roleattribute. - For stateful components (accordions, toggles, tabs, checkboxes, comboboxes), confirm the current state is communicated through the appropriate ARIA attribute.
- Test with a screen reader (e.g., NVDA + Chrome or VoiceOver + Safari): navigate to each interactive control and confirm its name, role, and state are announced correctly.
- Activate interactive controls (open accordions, toggle switches, select tabs) and confirm the screen reader announces the updated state.
- Check that any custom widgets built with
<div>,<span>, or<a>elements that function as buttons or other controls carry the necessaryroleandaria-*attributes.
Testing Tools
- NVDA — Free screen reader for Windows. Download, install, and open Firefox to test the demo. Navigate using Tab and arrow keys, and listen to role, name, and state announcements from the page.
- VoiceOver (macOS) — Built into macOS. Enable with Cmd+F5, then open Safari or Chrome to test the demo. Use VO+arrow keys to navigate and hear semantic structure announcements.
- Lighthouse — Browser accessibility audit in Chrome DevTools. Open DevTools (F12), go to Lighthouse, run the audit to identify semantic and labeling issues.
Demo
This control is a <div>. It has no role, no accessible name, and no state - a screen reader cannot identify it as a checkbox or read whether it is checked. It is also not keyboard focusable.
A native <input type="checkbox"> with a linked <label> automatically provides name ("Accept terms and conditions"), role ("checkbox"), and state ("checked" or "unchecked") to assistive technology.
Code
These form inputs have no associated <label> elements. Screen readers cannot determine which label corresponds to which field.
Each input has a proper <label> element linked via for and id attributes. Screen readers announce the label and input relationship.
Code
This is a styled <div> with a click handler. It has no role, no accessible name, and is not keyboard focusable. Screen readers cannot identify it as a button.
A native <button> automatically provides role ("button"), accessible name ("Delete Account"), and keyboard support (Enter/Space to activate).
Code
This menu button does not update aria-expanded when toggled. Screen readers always report the state as false, even when the menu is visually open.
This menu button properly updates aria-expanded and supports keyboard navigation. Screen readers announce state changes, and users can navigate with arrow keys.
Code
These icon-only buttons have no accessible name. A screen reader announces each one as just "button" — the user has no idea what any button does. This is the single most common 4.1.2 failure found in real-world audits.
Try navigating with a screen reader — each button is announced as just "button" with no label.
Each icon button now has an aria-label that describes its action. Screen readers announce "Search, button", "Close dialog, button", "Open menu, button", and "Add to favorites, button".
Now each button announces its purpose: "Search, button", "Close dialog, button", etc.
Code
Fail Explanation
A custom button built from a <div> or <span> element that has no role attribute and no accessible name fails this criterion, because a screen reader has no way to identify it as a button or know what it does. Similarly, a custom accordion widget that expands and collapses content but does not use aria-expanded to communicate its state leaves screen reader users unable to know whether the panel is open or closed. Using images as buttons without alt text, or linking icons without accessible names, are also very common failures.
Pass Explanation
A component passes when it has a programmatically determinable accessible name (from visible label text, aria-label, aria-labelledby, or an alt attribute), a correct semantic role (either from native HTML semantics or an explicit ARIA role), and accurate state information conveyed via ARIA attributes (such as aria-expanded, aria-checked, aria-selected, aria-pressed). Native HTML elements like <button>, <input>, <select>, and <a href> satisfy these requirements when used correctly with proper labels; custom widgets require explicit ARIA and scripting to achieve the same result.
Notes
This criterion specifically covers author-created UI components and does not apply to platform-level user agent controls that the author cannot modify. The easiest way to satisfy this criterion is to use native, semantic HTML elements (which have built-in name, role, and value semantics) rather than building custom widgets from generic elements, which require additional ARIA and scripting to achieve the same accessibility outcome.
Techniques
WCAG techniques used in this demo: H65, ARIA5, H44, ARIA14, ARIA16, H64, G131
Suggested Solutions & References
Curated from 163 real-world audit findings and official WCAG guidance.
Official W3C / WAI
- Understanding SC 4.1.2: Name, Role, Value
- ARIA Authoring: Dialog (Modal) Pattern
- ARIA Authoring: Combobox Pattern
- ARIA Authoring: Menu Button Pattern
- ARIA Authoring: Switch Pattern
- ARIA Authoring: Radio Group Example
- Technique ARIA14: Using aria-label for link purpose
- Technique H44: Using label elements for form controls
MDN Web Docs
- aria-label attribute
- aria-expanded attribute
- aria-pressed attribute
- aria-current attribute
- <button> element
- <select> element
- ARIA Live Regions