Skip to content
easeweb
Search topics

aria-hidden content that keyboard focus still reaches

A closed slide-out menu is moved off screen and given aria-hidden="true", which hides its links from screen readers but leaves every one of them in the tab order.

WCAG 2.2
SC 4.1.2A
Required by
Section 508 · EN 301 549 (EU)
Broken <nav class="drawer" aria-hidden="true">
The accessibility problem illustrated: Tab lands in the closed menu.
01

The problem

Keyboard and screen reader users land on links nobody can see or hear.

02

Try it

Press Tab from the Menu button and follow the focus.

With the menu closed, where does focus go after Menu, and what does a screen reader say there? Then open the menu and Tab through it.

Broken Can you fix this?

New this week

Linen tea towels in three colours, and a stoneware jug.

Read the journal

Screen reader says:

(Tab to the Menu button)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Hide the closed menu from sight, Tab and screen readers together, with CSS or inert.

  1. 1Never put aria-hidden="true" on anything that can take focus, or around it.
  2. 2Hide what is out of use from everyone at once: CSS hiding or inert, or every control inside out of the tab order.
  3. 3Move focus out before you hide what holds it.
Before A closed menu hidden from screen readers only
<button type="button" class="menu-button" aria-expanded="false" aria-controls="menu">Menu</button><nav id="menu" class="drawer" aria-label="Main" aria-hidden="true">  <a href="/shop">Shop</a>  <a href="/journal">Journal</a>  <a href="/about">About</a>  <a href="/contact">Contact</a></nav>
After

The closed menu hidden with CSS

<button type="button" class="menu-button" aria-expanded="false" aria-controls="menu">Menu</button><nav id="menu" class="drawer" aria-label="Main">  <a href="/shop">Shop</a>  <a href="/journal">Journal</a>  <a href="/about">About</a>  <a href="/contact">Contact</a></nav>

Fixing this with an AI coding assistant? Get this guide as Markdown

04

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the shared menu, carousel or dialog component changes.

Limits

This is a starting pattern, not a guarantee for every application. It covers content hidden with aria-hidden that focus can still reach. aria-hidden on something that can't take focus but carries information people need, such as a price or a warning, is a different failure that this guide doesn't fix. What a screen reader says on a hidden link varies between browsers and screen readers, so test with the ones your users have.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work