Skip to main content
WCAGrules
Quick navigation

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: name, role, and state exposed. Fails: a control with no identity.

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.

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.

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.

Go somewhere useful

Find tools, resources and your workspace.

29 destinations