Serious4.1.2 Name, Role, Value (Level A), 2.1.1 Keyboard (Level A)Rule ID: nested-interactive
Interactive elements must not be nested
An interactive element is placed inside another interactive element (for example, button inside link).
Rule Description
Checks DOM structure for interactive descendants inside interactive ancestors (links, buttons, form controls, elements with interactive roles).
Why It Matters
- Focus and click targets become ambiguous
- Screen readers may announce conflicting roles
- Keyboard interaction can trigger unexpected actions
How to Fix
Ensure each interactive control is separate and not nested within another control.
Bad Example:
<a href="/product"> <button>Add to cart</button> </a>
Good Example:
<a href="/product">View product</a> <button type="button">Add to cart</button>
Common Mistakes
- Wrapping entire card links around nested action buttons
- Clickable parent containers plus clickable child controls
- Mixing custom role-based controls with native controls
Testing
- Tab through controls and verify distinct focus stops
- Test click/Enter/Space behavior for each control independently
- Run automated checks for nested interactive violations
External Resources
Automate Your Accessibility Testing
Our tool automatically checks for this rule and hundreds of other accessibility issues.
Start Your Free Trial