Interactive elements nested inside each other
What it means and why it matters
A button inside a link (or vice versa) confuses keyboards and screen readers — the inner control is often unreachable (WCAG 4.1.2).
How to fix it
Restructure the markup so that links and buttons are siblings, not nested.
Code example
Before
<div role="button" tabindex="0" onclick="addToCart(42)">
Add to cart: <a href="/product/42">Rain jacket</a>
</div>
After
<a href="/product/42">Rain jacket</a>
<button type="button" onclick="addToCart(42)">Add to cart</button>
In our study
Share of online shop home pages on which axe-core automatically detected at least one failure of this rule. The number of shops is in brackets.
Interactive elements nested inside each other
| Country | Shops checked | With this failure |
|---|---|---|
| Poland | 84 | 9 (11%) |
| Czechia | 86 | 6 (7%) |
| Slovakia | 94 | 11 (12%) |
| Croatia | 92 | 6 (7%) |
| Total, wave 1 | 356 | 32 (9%) |
| Germany | 123 | 12 (10%) |
| Austria | 97 | 12 (12%) |
| Total, wave 2 | 220 | 24 (11%) |
| Netherlands | 100 | 4 (4%) |
| Spain | 94 | 13 (14%) |
| France | 101 | 12 (12%) |
| Italy | 101 | 15 (15%) |
| Total, wave 3 | 396 | 44 (11%) |
Method, limits and all results: Online shop study.
Find this error on your website
Run a free check of any page — results in seconds, with fix instructions.