Home / Fix guides / Accessibility (WCAG)

How to fix "aria-hidden elements contain focusable elements"

This warning means part of your page is hidden from screen readers with aria-hidden="true", but it still holds a link, button or field that keyboard users can reach. Fix it by hiding that content properly (or by removing aria-hidden), so that what is hidden is hidden for everyone.

When part of a page is marked aria-hidden="true", screen readers skip it as if it were not there. If that part still contains a link, button or form field, a keyboard user can land on it with the Tab key, while a screen reader user hears nothing or something confusing. Tools report this as "[aria-hidden=\"true\"] elements contain focusable descendents" (Lighthouse) or as the aria-hidden-focus rule (axe).

What people see

Most visitors notice nothing, because the page looks fine. The people affected are those who use a keyboard, a switch device or a screen reader. They typically run into one of these:

  • They press Tab and the focus seems to vanish, because it moved to something invisible.
  • A screen reader says nothing, or only "button" or "link" with no name, when focus lands on the hidden item.
  • They tab into a closed menu, an off-screen slide or a pop-up they cannot see.

The usual sources are image sliders with inactive slides, mobile menus that are closed, pop-ups and cookie banners, and the page behind an open modal window.

Why it matters

  • Real people get stuck. Someone who cannot tell where focus is may fail to finish your contact form, booking or checkout.
  • It is an accessibility failure. It relates to WCAG success criterion 4.1.2 (Name, Role, Value). Accessibility rules and laws in some countries refer to WCAG, so audits and complaints often cite issues like this.
  • It lowers your scores. It reduces your Lighthouse accessibility score. It is not a known direct ranking factor, but it usually points to a menu, slider or pop-up that is not built carefully.

How to check if your site has it

All of these are free:

  1. Open your page in Chrome, press F12, choose the Lighthouse tab, tick Accessibility and run the report. Look for the audit named after aria-hidden and focusable descendents. It lists the exact elements.
  2. Install the free axe DevTools browser extension, or use the WAVE extension, and scan the page. Look for aria-hidden-focus in axe.
  3. Do a Tab test. Click in the page, then press Tab repeatedly. If the focus outline disappears for a few presses, focus is probably inside something hidden. If you cannot see where focus is at all, that is a related problem: missing focus indicator.
  4. In DevTools, open the Elements tab, press Ctrl+F (Cmd+F on Mac) and search for aria-hidden. Check whether any match contains a link, button, input or an element with tabindex="0".

Test the page in different states too: with the menu open and closed, on each slide, and with pop-ups showing.

How to fix it in general

For each flagged element, decide whether it should be hidden from everyone or available to everyone.

  • It is visible and people should use it: remove aria-hidden. This often happens when someone added it to a whole section by mistake.
  • It is hidden visually (closed menu, inactive slide, collapsed panel): hide it properly. The hidden attribute, display: none and visibility: hidden all remove the content from both the screen reader view and the Tab order.
  • It is visible but temporarily inactive (the page behind an open modal): use the inert attribute on the background, which blocks focus and hides it from assistive technology. Current major browsers support it. A native <dialog> opened with showModal() also handles this for you.
  • Last resort: set tabindex="-1" on every link and button inside, and disabled on form fields. This works but is easy to break when content changes.

A common mistake is putting aria-hidden on a link or button itself. Putting it on a decorative icon inside a button is fine, as long as the button is not hidden.

<!-- Before: hidden from screen readers, still reachable by Tab -->
<div class="slide" aria-hidden="true">
  <a href="/sale">Shop the sale</a>
</div>

<!-- After: inactive slide hidden from everyone -->
<div class="slide" hidden>
  <a href="/sale">Shop the sale</a>
</div>

Common platforms

On most sites this comes from a theme, slider, menu or pop-up script, not from your own content. That means the first step is usually to update the theme or plugin, then re-test. What you can change depends on your theme and version.

  • WordPress: look at sliders, mobile menus and pop-up plugins. Switch them off one at a time and re-run the check to find the culprit. See the WordPress guide.
  • Shopify: the cause is usually in the theme. Under Online Store, Themes, you can search the theme code for aria-hidden, or ask the theme developer for an update. See the Shopify guide.
  • Wix and Webflow: use the built-in hide or display settings for elements rather than custom attributes. Check any custom code or custom attributes you added.
  • Elementor: carousels, menus and pop-up widgets are the usual suspects. Update Elementor and check any custom attributes on the widget.
  • React and Next.js: prefer not rendering hidden content at all, or use hidden or inert, instead of toggling aria-hidden by hand. Check how your React version handles the inert attribute.

How to confirm the fix worked

  1. Run Lighthouse or axe again and check that the audit now passes.
  2. Tab through the whole page with every menu, slide and pop-up in each state. Focus should only ever land on things you can see.
  3. If you can, try a screen reader: NVDA is free on Windows and VoiceOver is built into Mac and iPhone. Each thing it reads should have a clear name.
  4. Test on a phone-sized window, since mobile menus are a frequent cause.

How to stop it coming back

  • Re-test after theme, plugin or page builder updates, and after adding a new slider, menu or pop-up.
  • Do not add aria-hidden by hand unless you know exactly why. Hiding content with the proper tools is safer.
  • Make the Tab test part of publishing: press Tab through the page before you go live.
  • Ask your developer or theme vendor whether their components manage hidden states correctly.

SiteMonday checks this in week 7, the WCAG 2.2 accessibility audit, and the written report comes with a ranked fix list. Making the changes is up to you or your developer.

Step by step for your platform

Questions

What does aria-hidden="true" do?

It removes an element and everything inside it from what screen readers can see. It does not hide anything visually and it does not stop keyboard focus.

Is it ever fine to use aria-hidden?

Yes. It is fine on decorative things such as an icon next to a text label, as long as nothing focusable is inside it. The problem only appears when a link, button or field is inside the hidden area.

Is aria-hidden with tabindex="-1" a valid fix?

Checkers like axe accept it because the items leave the Tab order. It is fragile, though, since anything added later may be focusable again, so hiding the content properly or using `inert` is better.

Should I use display: none instead of aria-hidden?

If the content should be hidden from everyone, yes. `display: none` and the `hidden` attribute remove it from sight, from screen readers and from the Tab order in one step.

Will this hurt my Google rankings?

It is not known to be a direct ranking factor. It does lower your Lighthouse accessibility score and can stop some visitors from using your site.

Can I fix this without a developer?

Sometimes. Updating a theme or plugin, switching off a faulty slider or pop-up, or using your builder's hide setting often solves it. If the cause is in theme code, a developer will be needed.

Related problems