NeovaPiattaforma SEO avanzata

aria-hidden=true è impostato sull'elemento body

In Neova Funziona con la scansione stessa: niente da configurare.

Regola rivista il 17 ottobre 2026 · Guida aggiornata il 7 luglio 2026

Questo nasconde agli screen reader tutto il contenuto della pagina HTML, il che è in conflitto con i criteri WCAG 1.3.1 e 4.1.2.

Cosa potresti fare

Rimuovi aria-hidden dall'elemento body. Se lo imposta lo script di una finestra modale, applicalo invece al contenuto dietro la finestra modale.

Perché Neova lo segnala

  • aria-hidden=true sul body nasconde l'intera pagina agli screen reader, anche se resta visibile sullo schermo.
  • Gli script dei modali spesso lo impostano e non lo rimuovono, e la pagina resta muta dopo la chiusura del modale.
  • È in conflitto con i criteri WCAG 1.3.1 e 4.1.2, entrambi di livello A.

Fonti

La guida completa

Per ora questa parte è in inglese.

What This Check Flags

This check fails when aria-hidden="true" is set on the <body> element. Because aria-hidden cascades to every descendant, putting it on the body hides the entire page from assistive technology — a screen reader is handed a document with, effectively, nothing in it. For someone relying on that screen reader, your fully rendered page is a blank wall.

This is not a subtle degradation like low contrast. It is an all-or-nothing failure: sighted users see a normal page, screen-reader users get silence. And it is almost never intentional — it is collateral damage from code that was trying to hide something else.

A Real Failing Example, and the Fix

The usual cause is a modal or overlay script that hides the background while a dialog is open, then targets the wrong node or forgets to clean up. Here is the broken pattern:

<!-- Modal open: script hides "the rest of the page"
     but points at <body> instead of a page wrapper -->
<body aria-hidden="true">
  <div id="app"> ... entire site ... </div>
  <div class="modal" role="dialog"> ... </div>
</body>

Since the dialog is inside the hidden body, even the modal the script wanted to show gets hidden from assistive tech. The fix is to never mark the body itself. Wrap the page content in a container, hide that container when the modal opens, and keep the modal a sibling outside the hidden wrapper:

<body>
  <div id="app" aria-hidden="true"> ... page content ... </div>
  <div class="modal" role="dialog" aria-modal="true"> ... </div>
</body>

<script>
  // On close, remove it, never leave it stuck on:
  document.getElementById('app').removeAttribute('aria-hidden');
</script>

Better still, modern browsers support the inert attribute, which removes an element from the accessibility tree and blocks focus and pointer events — a cleaner tool for backgrounding content behind a modal than aria-hidden alone.

aria-hidden Values and What They Do

Half the confusion here comes from misunderstanding what the attribute's values mean. This table clears it up:

On the Body Effect on Assistive Tech Verdict
aria-hidden="true" Entire page removed from the accessibility tree Fails this check — never do this
aria-hidden="false" No-op on body, but a code smell worth removing Passes, but delete it
Attribute absent (default) Page is fully exposed to assistive tech Correct state
aria-hidden="true" on a decorative child Only that child is hidden Fine — and often correct
inert on a background wrapper Hides + blocks focus/pointer, body untouched Preferred for modals

The takeaway: aria-hidden="true" is a perfectly good tool on a decorative icon or an offscreen carousel slide. The problem is exclusively its placement on <body> (or on the root wrapper that contains everything), where it takes the whole page down with it.

How to Detect It

  1. Run an automated checker (axe, Lighthouse). The rule "aria-hidden='true' must not be present on the document body" reports it directly with a clear pass/fail.
  2. Inspect the live DOM, not just the source. This attribute is frequently added by JavaScript after load, so view the rendered <body> in DevTools while the page and any modals are open and closed.
  3. Search your codebase for aria-hidden applied to document.body or to a top-level wrapper, and for scripts that set it on open without a matching removal on close.
  4. Test with an actual screen reader (VoiceOver, NVDA). If it announces nothing on a visibly full page, a body-level aria-hidden is the prime suspect.
  5. Exercise every modal, drawer, and overlay open-and-close cycle — the bug often only appears in the "stuck on after close" state.

How to Fix It

  1. Remove aria-hidden from <body> entirely. The body should never carry it.
  2. To background page content behind a modal, wrap that content in a container and apply aria-hidden (or, better, inert) to the wrapper — keeping the modal outside it.
  3. Guarantee cleanup: whatever adds the attribute on open must remove it on close, including on error paths and route changes.
  4. Audit third-party widgets and modal libraries; some manage focus by hiding the body and never restore it. Configure or patch them to target a wrapper.
  5. Re-test with a screen reader after the change to confirm the page is announced again.

FAQ

Is aria-hidden Always Bad?

Not at all. On a decorative icon, a duplicate offscreen element, or an inactive carousel slide, aria-hidden="true" is exactly right — it stops assistive tech from announcing noise. The failure is specific to putting it on the <body> (or the single wrapper that holds the whole page), which hides everything.

Why Does One Attribute Hide the Whole Page?

aria-hidden inherits down the tree. Setting it on an ancestor hides that element and all of its descendants from the accessibility tree. Since <body> is the ancestor of every visible thing on the page, hiding it hides the lot.

What Should I Use to Hide the Background Behind a Modal?

Apply the hiding to a content wrapper, never the body, and keep the modal as a sibling outside that wrapper. The inert attribute is the modern best choice because it removes the background from the accessibility tree and also blocks focus and clicks, so keyboard users cannot tab into hidden content.

It Is Added by JavaScript, so It Is Not in My HTML Source. Does That Matter?

No — assistive tech reads the live DOM, not your original source. If a script sets aria-hidden="true" on the body at runtime, the page is hidden regardless of what the source file says. Always inspect the rendered DOM.

Does This Hurt SEO?

Search crawlers largely ignore aria-hidden for indexing, so ranking impact is minimal. The real cost is a broken experience for screen-reader users and the legal and reputational exposure that comes with it. It sits in the same family as other structural ARIA mistakes — see required ARIA attributes and the broader accessibility and SEO overview.

Trovalo sul tuo sito

Neova esegue questo controllo e tutti gli altri a ogni scansione, poi scrive la correzione come ticket per il tuo team.

  • App desktop per Mac, Windows e Linux
  • Tutti i 696 controlli, ognuno con la sua fonte
  • Search Console e Analytics 4, collegati in sola lettura
  • Ticket verso Jira, Linear e Asana

Scarica Neova Piano Desktop Free, oppure Solo gratis per 14 giorni, senza carta.

Tutti i controlli della categoria Accessibilità · Guide · Libreria dei controlli

Scritto da Neova Labs · Torna alla Libreria dei controlli