Blog · 13 min read

aria-hidden Misuse: 7 Mistakes and How to Fix Them

Developer testing keyboard focus on a webpage

The most common aria-hidden misuse is putting aria-hidden="true" on something a person can still reach with a keyboard. The attribute removes an element and everything inside it from the accessibility tree, so screen readers skip it. It does not hide anything visually, and it does not stop focus. That gap between what sighted keyboard users can reach and what screen reader users can perceive is where most bugs come from. This guide shows when to use the attribute, the seven mistakes we see most often, and how to test and fix them in your own code.

AccessWiser
Find Accessibility Issues in Your Code
AccessWiser scans against WCAG 2.2 AA, links findings to affected elements, and provides plain-language guidance for fixing issues in your site's code.
Explore AccessWiser

TL;DR

  • aria-hidden="true" hides an element and all its descendants from assistive technology. It does not hide them visually and does not remove them from the tab order.
  • Never put it on a focusable element or on an ancestor of one. That leaves keyboard users focusing on nothing.
  • aria-hidden="false" on a child cannot undo aria-hidden="true" on a parent.
  • Use it for decorative icons, duplicated content and the background behind a modal. Skip it when hidden, display: none or visibility: hidden already does the job.
  • Test with an automated scan, a keyboard pass and the browser’s accessibility tree view. Fix the markup itself, not a patch on top.

Table of Contents

What aria-hidden actually does

MDN describes aria-hidden="true" as a signal that the element and its descendants are not exposed to the accessibility tree. Screen readers, braille displays and other assistive technologies build their view of a page from that tree. If a node is missing, those tools generally act as if it does not exist.

Three things follow from that definition.

  1. It is not visual. MDN’s reference states that aria-hidden changes exposure to assistive technology, not rendering. A paragraph with aria-hidden="true" stays on screen unless CSS also hides it. Sighted users see it. Screen reader users do not hear it.
  2. It is inherited. Every child, grandchild and nested widget inside the element goes with it.
  3. It does not change behavior. Links, buttons and inputs inside a hidden subtree still take focus and still respond to the keyboard. The University of Minnesota’s accessibility office makes the same point about ARIA in general: it does not create interaction behavior, so developers remain responsible for keyboard and focus handling.

A good mental model: aria-hidden edits what assistive technology is told about the page. It never edits the page. If the two disagree, someone is going to be confused.

If you are newer to how ARIA fits into markup, the ARIA labels best practices guide covers the naming side of the same toolbox. A website accessibility guide for business owners gives helpful context if you are not the person writing the code.

When to use aria-hidden

The attribute has legitimate jobs. MDN’s guidance is to use it for non-interactive content that is purely decorative, duplicated, or offscreen or collapsed, when excluding it improves the experience. W3C’s ACT rule on this attribute agrees that it can hide purely decorative content from assistive technologies.

Good uses:

  • Decorative icons next to text. A magnifier icon beside the word “Search” adds nothing when read aloud. Chrome’s coding guidance says to hide decorative SVGs from assistive technologies and not to hide interactive elements.
  • Redundant text. A visual star rating drawn with symbols, when a text equivalent such as “4 out of 5 stars” is already exposed.
  • Inert background behind a modal. web.dev notes that for modal UI that blocks the main page, out-of-scope parts of the page should be aria-hidden.
  • Decorative images that use inline markup, such as a background flourish built from an empty div with a pseudo-element.

A simple decision rule:

Question If yes If no
Is the content purely decorative or duplicated? aria-hidden="true" is fine Keep it exposed
Can anything inside it receive focus? Do not use aria-hidden; remove it from focus or the page first Safe to continue
Is it already hidden with hidden, display: none or visibility: hidden? Do not add it; it is redundant Consider it
Does it carry meaning visible to sighted users? Expose equal meaning elsewhere first Safe to continue

The third row comes straight from MDN: those CSS and HTML mechanisms already remove the element from the accessibility tree, so adding the attribute only creates noise. W3C’s ARIA in HTML document says the same, noting the attribute is generally unnecessary where the hidden attribute applies.

The seven most common aria-hidden mistakes

1. Hiding a focusable element

This is the big one. W3C’s ARIA in HTML says authors must not use aria-hidden=“true” on focusable elements. Picture a button that is still tabbable but invisible to a screen reader. A keyboard user lands on it, hears nothing, and has no idea what they just focused. The University of Minnesota guide describes this as leaving some users focusing on nothing.

<!-- Problem -->
<button aria-hidden="true">Add to cart</button>

<!-- Fix: remove the attribute -->
<button>Add to cart</button>

If you truly want the control gone for everyone, use the hidden attribute or display: none, which removes it from both the tab order and the accessibility tree.

2. Hiding an ancestor of a focusable element

The rule also covers parents. MDN says not to use the attribute on focusable elements or on their parents or ancestors. The W3C ACT rule frames the check as no descendants that are focusable in sequential keyboard navigation. The accessibility developer guide puts it plainly: no focusable element, and no container of focusable children.

This one hides in plain sight. A wrapper div gets aria-hidden="true" for a decorative reason, then a developer later adds a link inside it. Nobody revisits the wrapper.

3. Putting it on the body or a page-wide wrapper

Modal libraries commonly set aria-hidden="true" on the app root while a dialog is open. If the dialog itself lives inside that root, or the attribute is never removed when the dialog closes, the whole page becomes silent for screen reader users. A well-known report describes how easy it is to make a modal completely inaccessible by mistake when a library is not told which element is the app root. We cite it as a real-world example of the pattern, so check your own library’s documentation for its setup call.

Safe pattern: render the dialog as a sibling of the app root, hide only the app root while the dialog is open, and remove the attribute on close.

4. Expecting aria-hidden=“false” to rescue a child

Developers sometimes nest a visible block inside a hidden one and mark it aria-hidden="false". It does not work. W3C’s ACT rule states that aria-hidden=“false” on a descendant does not override aria-hidden=“true” on an ancestor. MDN repeats that the hidden state is inherited and a child cannot override an ancestor’s hidden state.

<!-- Problem: the inner paragraph is still hidden -->
<div aria-hidden="true">
  <p aria-hidden="false">Important notice</p>
</div>

<!-- Fix: restructure so the notice is not inside the hidden subtree -->
<div aria-hidden="true">...decorative...</div>
<p>Important notice</p>

The same logic means you should be careful with aria-hidden="false" on its own. In most cases, simply leaving the attribute off is cleaner.

5. Hiding meaningful visible content

MDN is clear that you should not use the attribute to remove meaningful visible content unless equivalent meaning and functionality are exposed elsewhere. Typical examples: a price, a form error shown in red text, or a status badge hidden because it “looks like decoration.” If a sighted user can read it and act on it, a screen reader user should be able to as well.

6. Stacking it on top of other hiding methods

A menu panel closed with display: none does not need aria-hidden="true" as well. The duplication is harmless at first, then one of the two gets removed during a refactor and the states drift apart. Pick one mechanism that controls both the visual and the accessibility state. For collapsible panels, our accordion accessibility checks and tabs markup habits show how to keep hidden panels consistent with their controls.

Carousels are a frequent source of aria-hidden violations. A slide that is not currently visible gets aria-hidden="true", but the links inside it remain in the tab order. Chrome’s guidance points developers toward managing the attribute based on slide visibility or, better, removing non-visible slides from the DOM or the focus order entirely.

The cleanest options for inactive slides:

  • Apply the inert attribute, or hidden, so focus and the accessibility tree both skip them.
  • If you must use aria-hidden, also set tabindex="-1" on every link and button inside, and reverse both when the slide becomes active.

We walk through this pattern with automated checks in 6 CI tests for carousel accessibility.

Using aria-hidden with icons and dialogs

Icons

Icons come in two kinds: decorative, and meaningful on their own. A decorative icon beside visible text gets aria-hidden="true" and, for inline SVG, usually focusable="false" as well to keep older browsers from tabbing into it. An icon-only button is different. The icon can be hidden, but the button itself needs an accessible name:

<button type="button">
  <svg aria-hidden="true" focusable="false">...</svg>
  <span class="visually-hidden">Close</span>
</button>

Notice the button is not hidden. Only the decoration inside it is.

Dialogs

Chrome’s guidance for dialogs has three parts: when one appears, focus moves into it, stays within it, and returns to the opener on dismissal. Hiding the background with aria-hidden supports the screen reader half of that story. Focus management supports the keyboard half. You need both, because hiding the background from the accessibility tree does not stop Tab from reaching it in every setup.

A short checklist for modals:

  1. Open: move focus to the dialog heading or first control.
  2. Background: mark the sibling content aria-hidden="true" (or inert), never the dialog’s own ancestors.
  3. While open: keep Tab and Shift+Tab inside the dialog.
  4. Close: remove the attribute from the background and return focus to the trigger.

Tooltips and popovers raise similar timing questions, which we cover in our tooltip accessibility guide.

How to find aria-hidden problems

No single check catches everything. Combine three.

Automated rules

The W3C ACT rule gives the test logic: check that elements with aria-hidden=“true” have no descendants that are focusable in sequential keyboard navigation. Engines such as axe-core implement it, and Chrome’s guidance notes that automated tools can flag interactive elements inside an aria-hidden container as a WCAG 4.1.2 (Name, Role, Value) problem. Success Criterion 4.1.2 is Level A, as the Section508.gov guide to accessible web design recaps.

Automated checks detect a substantial subset of barriers, not all of them. They are excellent at spotting a focusable link inside a hidden wrapper. They cannot judge whether a hidden price should have been exposed.

Automated rules

A keyboard pass

Unplug the mouse. Tab through each page and each open state: menus, modals, carousels, accordions. Whenever focus seems to vanish, or a visible ring lands on something you cannot see, inspect that element and its ancestors for aria-hidden.

The accessibility tree

Chrome recommends verifying the tree directly in developer tools, since automated tools might miss semantics in custom elements. Open the Accessibility pane, select a suspect element and confirm it appears (or is ignored) as you intended. Then run a short screen reader test with the combination your audience uses most. Our combobox testing guide lists the screen reader and browser pairs worth trying.

A repeatable fix workflow

  1. Find each aria-hidden="true" in your templates and components. Search the code for the attribute, not just the rendered pages.
  2. Classify each one: decorative, duplicate, off-screen, modal background, or unknown.
  3. Check focus. For each, ask whether anything inside can receive focus.
  4. Replace with a better mechanism where one exists: hidden, inert or display: none for content that should vanish for everyone.
  5. Remove the attribute where it only duplicates another hiding method.
  6. Re-test keyboard and screen reader behavior in each state.
  7. Guard against regressions with scheduled re-checks. Components get edited, and a one-line change can reintroduce the problem.

For a one-person site, this is an afternoon. For a store with hundreds of templates, step seven is what keeps the work from unraveling.

Our perspective on aria-hidden

We see aria-hidden misuse as a symptom of a bigger habit: treating ARIA as a coat of paint. A developer wants a widget to feel tidy for screen reader users, adds the attribute, and moves on. The markup looks intentional, and the problem stays invisible until someone navigates by keyboard.

That is why we built AccessWiser around code-level findings. Each issue is tied to the specific element and the success criterion it affects, with plain-language guidance for fixing it in your own code. A permanent fix, such as removing the attribute from a wrapper or swapping it for inert, is better than a runtime patch layered over the top.

We are also candid about what automation can do. Scans detect a substantial subset of barriers, and a focusable element inside a hidden container is exactly the kind of pattern they find well. Judgment calls, like whether hidden content carries meaning, still need a person. Scheduled re-checks and dated records of scans and fixes help your team prove the work happened and catch regressions early.

Accessible sites are built by teams who treat every user’s path through the page as equally important. That is an achievable goal, one component at a time.

The AccessWiser Team

Find aria-hidden issues before your visitors do

AccessWiser scans your pages against WCAG 2.2 AA, with Section 508 and EN 301 549 mappings, and points to the element and criterion behind each finding. Plans start at $24 per month on the Starter plan, and every plan begins with a 7-day free trial. Start with a scan of your most visited templates, fix what it finds in your code, then let scheduled re-checks watch for regressions. You can also explore the AccessWiser homepage for an overview of the product.

FAQ

Does aria-hidden=“true” hide content visually?

No. It only removes the element and its descendants from the accessibility tree, so assistive technology ignores them. Sighted users still see the content unless CSS or the hidden attribute also hides it. If you want content gone for everyone, use hidden or display: none.

Not if the element can receive focus. W3C’s ARIA in HTML says authors must not use aria-hidden="true" on focusable elements. If the control should not be available, use hidden, inert or disabled as appropriate, so keyboard users cannot reach it either.

Does aria-hidden=“false” make a child visible to screen readers inside a hidden parent?

No. The hidden state of the ancestor wins, and a descendant cannot override it. Move the content outside the hidden container, or remove the attribute from the parent.

Should I add aria-hidden to something that is already display: none?

No. Elements hidden with display: none, visibility: hidden or the hidden attribute are already removed from the accessibility tree. Adding the attribute is redundant and can become a source of conflicting states later.

When is aria-hidden the right choice?

Use it for decorative icons, duplicated text and the page background behind an open modal, as long as nothing inside is focusable. Pair it with proper focus management for dialogs, and verify the result with a keyboard pass and the accessibility tree.

Sources

Articles on this blog are general information about web accessibility, not legal advice. Laws change and their application depends on your specific situation — for decisions with legal consequences, consult a qualified legal professional.

Articles on this blog are general information about web accessibility, not legal advice. Laws change and their application depends on your specific situation — for decisions with legal consequences, consult a qualified legal professional.