Language: EN

Interactive elements nested inside each other

Message shown by axe and Lighthouse: Interactive controls must not be nested · nested-interactive · WCAG 4.1.2

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

CountryShops checkedWith this failure
Poland849 (11%)
Czechia866 (7%)
Slovakia9411 (12%)
Croatia926 (7%)
Total, wave 135632 (9%)
Germany12312 (10%)
Austria9712 (12%)
Total, wave 222024 (11%)
Netherlands1004 (4%)
Spain9413 (14%)
France10112 (12%)
Italy10115 (15%)
Total, wave 339644 (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.

Check a page for free

All accessibility errors

Order a paid plan

Leave your email and we'll contact you as soon as the plan can be ordered.