nested-interactiveControl is nested inside another control
A link or button placed inside a button, or inside a custom control such as role="tab" or role="option", is hidden from screen readers because those controls flatten everything inside them. Move the inner control out so the two sit side by side.
Who it hurts
Screen reader users, who never hear the inner control, and keyboard users, who get confusing focus.
Clickable product cards with a wishlist button inside, and tabs with a close button inside, are the usual cases.
How to fix it
Pick your stack. Review every change before you ship it.
Before
<div role="button" tabindex="0" class="card">
Linen shirt
<button>Add to wishlist</button>
</div>After
<div class="card">
<a href="/products/linen-shirt">Linen shirt</a>
<button type="button">Add to wishlist</button>
</div>Check it by hand too
Tab through the component with a screen reader on. Each control should get its own focus stop and its own name.
Automated checks find a large share of accessibility problems, but not all of them. Passing this check does not on its own make a page compliant.
WCAG reference
- 4.1.2 Name, Role, Value (Level A). Understanding 4.1.2