Use HTML the way the spec intends
Use HTML elements for the jobs the specification gives them. Buttons for actions, links for navigation, headings for headings, list markup for lists, and nesting that parses. W3C lists H88 as sufficient for 4.1.2 Name, Role, Value in combination with the general technique for exposing name and role. The technique itself has three parts. Use only features the specification defines, use them the way it prescribes, and let the content parse. The reason for the first part is the one people skip. A non-standard feature usually ships in one browser first, and assistive technology, built with far fewer resources, may take years to support it or may never get there. The old parsing rule, 4.1.1, is gone. WCAG 2.2 removed it and it counts as satisfied under 2.0 and 2.1, so a validator error is a code-quality finding now rather than a conformance one. What still fails is a misused element, because a div doing a button's job repairs into nothing at all.
How we find it in an audit
The split here is clean and W3C draws it the same way we do. Validators and scanners handle the mechanical layer, invalid nesting, duplicate ids, attributes that do not exist. The semantic layer needs a person. Clickable divs, links that behave like buttons, heading levels chosen for their font size.
How affected users experience it
Assistive technology runs on a contract. The element says what it is and the software tells the user what to expect from it. Hear button and you know the space bar will press it. When the button is a div with a click handler, the space bar scrolls the page instead and the thing you meant to do does not happen. Every off-spec shortcut becomes a small trap for the person who trusted the contract.
Passes vs. fails
Passes
<button type="button" onclick="save()">Save</button>Fails
<div class="btn" onclick="save()">Save</div>How this gets tested
The W3C publishes test rules that define what a checker looks for here.
- Image button has non-empty accessible nameA tool can check this
- Link has non-empty accessible nameA tool can check this
- ARIA attribute is defined in WAI-ARIAA tool can check this
- ARIA state or property has valid valueA tool can check this
- Element with role attribute has required states and propertiesA tool can check this
- Form field has non-empty accessible nameA tool can check this
- Role attribute has valid valueA tool can check this
- ARIA state or property is permittedA tool can check this
- Button has non-empty accessible nameA tool can check this
- Element with aria-hidden has no content in sequential focus navigationA tool can check this
- Element with presentational children has no focusable contentA tool can check this
- Menuitem has non-empty accessible nameA tool can check this
- Summary element has non-empty accessible nameA tool can check this
- Iframe element has non-empty accessible nameA tool can check this
- Iframe elements with identical accessible names have equivalent purposeA tool finds candidates, you decide
Other ways to satisfy this rule
23 guides on this site are filed under 4.1.2 Name, Role, Value. W3C lists this one as sufficient for that rule only alongside G108, so the pair is what passes and neither half does on its own.
- ARIA4sufficientGive custom widgets a real ARIA role
- ARIA5sufficientExpose widget state with ARIA attributes
- ARIA14sufficientLabel icon-only controls with aria-label
- ARIA16sufficientName controls from visible text with aria-labelledby
- G10sufficientBuild custom components on accessibility-supported tech
- G108sufficientExpose name, role, and changes through markup
This guide is our interpretation of W3C technique H88: Using HTML according to spec. W3C publishes its techniques as guidance rather than as the standard, and says so on every one of them. The success criterion is what conformance is measured against, and a technique is one documented way to meet it.