Rule
Nested controls
A control must not contain another control.
- Rule
nested-interactive- WCAG 2.2
- 4.1.2 Name, Role, Value (opens in a new tab) (Level A)
- Severity
- Serious
What it checks
The rule looks inside links, buttons, form fields, <summary>, media with controls, and elements with a widget role such as button, link, checkbox, tab or option. It fails one that contains another control a user can reach, such as a button inside a link. The two compete for focus, and what a screen reader announces for them becomes unpredictable.
Only reachable controls count. Hidden and disabled controls, content inside inert, and elements with a widget role but no tabindex are left out.
When a person decides
Two shapes are sent for review. A control inside a <summary> is allowed by HTML and both keep their name and role, so a person checks that each does what users expect. A control with a negative tabindex inside an ARIA widget is out of the tab order but can still take focus from a click or a script, so its name, role and behaviour need checking.
Example
Fails
<a href="/products/kettle/">
<h3>Steel kettle</h3>
<button type="button">Add to basket</button>
</a>
Passes
<div class="card">
<h3><a href="/products/kettle/">Steel kettle</a></h3>
<button type="button">Add to basket</button>
</div>
The engine is tested against both examples.
How to fix it
Make the controls siblings rather than one inside the other. For a clickable card, put the link on the heading and keep other buttons beside it.
Check your own pages
This rule runs in every pour audit: the browser extension, the bookmarklet, the command line and the editor. Get pour, free.