JavaScript Element ariaHidden Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline
Instance property

What You’ll Learn

Element.ariaHidden is an instance property that reflects the aria-hidden attribute. Learn the true, false, and undefined tokens, how they control exposure to accessibility APIs, and how to get or set the property from JavaScript—with five examples and try-it labs.

01

Kind

Instance property

02

Type

String

03

Values

true · false · undefined

04

Reflects

aria-hidden

05

Status

Baseline widely

06

Affects

Accessibility API

Introduction

Sighted users and assistive technology users do not always need the same content. Decorative icons, duplicated text, or off-screen panels can clutter the accessibility tree if they stay exposed.

aria-hidden tells the accessibility API whether an element should be exposed. ariaHidden is the JavaScript reflection of that attribute.

JavaScript
const el = document.getElementById("hidden");
console.log(el.ariaHidden); // "true"
el.ariaHidden = "false";
💡
Beginner tip

aria-hidden="true" hides content from assistive technologies—not necessarily from the screen. Do not put focusable controls (links, buttons, inputs) inside a subtree marked aria-hidden="true". Prefer removing content, using the HTML hidden attribute, or inert when you need both visual and interaction hiding.

Understanding the Property

MDN: the ariaHidden property of the Element interface reflects the value of the aria-hidden attribute, which indicates whether the element is exposed to an accessibility API.

  • Reflected attribute — mirrors aria-hidden.
  • Get / set — readable and writable string.
  • Three tokenstrue, false, undefined.
  • Baseline — widely available since October 2023 (MDN).

📝 Syntax

JavaScript
ariaHidden

Value

A string with one of the following values:

ValueMeaning (MDN)
"true"The element is hidden from the accessibility API.
"false"The element is exposed to the accessibility API as if it were rendered.
"undefined"The element’s hidden state is determined by the user agent based on whether it is rendered.
⚠️
Focus trap warning

If keyboard focus can land on something inside aria-hidden="true", users may hear nothing useful while still being able to interact. Hide or disable focusable descendants when you hide a region from AT.

📋 MDN Example Shape

MDN starts with aria-hidden="true" on a div, then updates it to "false" with the property:

JavaScript
<div id="hidden" aria-hidden="true">Some things are better left unsaid.</div>
JavaScript
let el = document.getElementById("hidden");
console.log(el.ariaHidden); // true
el.ariaHidden = "false";
console.log(el.ariaHidden); // false

⚡ Quick Reference

GoalCode / note
Readel.ariaHidden
Hide from ATel.ariaHidden = "true"
Expose to ATel.ariaHidden = "false"
UA decidesel.ariaHidden = "undefined"
Not CSS hideUse CSS / hidden / inert for visual/interaction
MDN statusBaseline Widely available

🔍 At a Glance

Four facts about Element.ariaHidden.

Kind
get / set

Instance

Type
string

true / false / undefined

Reflects
aria-hidden

Attribute

Baseline
widely

Oct 2023+

Examples Gallery

Examples follow MDN Element: ariaHidden. Labs use a simple element so you can safely read and write the property.

📚 Getting Started

Read the reflected value and follow MDN’s update.

Example 1 — Read ariaHidden

Log whether an element is currently marked hidden from AT.

JavaScript
const el = document.getElementById("hidden");
console.log(el.ariaHidden);

// HTML includes: aria-hidden="true"
Try It Yourself

How It Works

The property returns the attribute string. If the attribute is missing, many browsers return null.

Example 2 — MDN Update to "false"

MDN: expose the element to the accessibility API again.

JavaScript
let el = document.getElementById("hidden");
console.log(el.ariaHidden); // true
el.ariaHidden = "false";
console.log(el.ariaHidden); // false
Try It Yourself

How It Works

Assigning the property updates the reflected aria-hidden attribute so assistive technologies can include the element again.

📈 Hide Decorative Content, Attribute Sync & Snapshot

Practice common patterns and verify reflection.

Example 3 — Hide Decorative Markup

Mark a decorative span so screen readers skip it.

JavaScript
const icon = document.createElement("span");
icon.textContent = "*";
document.body.appendChild(icon);

icon.ariaHidden = "true";
console.log({
  ariaHidden: icon.ariaHidden,
  attr: icon.getAttribute("aria-hidden")
});
Try It Yourself

How It Works

Decorative icons and duplicate text are common places for aria-hidden="true". Keep a meaningful accessible name on the real control (for example via visible text or aria-label).

Example 4 — Property vs getAttribute

Confirm the attribute stays in sync after a write.

JavaScript
const el = document.createElement("div");
el.setAttribute("aria-hidden", "true");
el.textContent = "Some things are better left unsaid.";
document.body.appendChild(el);

el.ariaHidden = "false";
console.log({
  fromProperty: el.ariaHidden,
  fromAttribute: el.getAttribute("aria-hidden"),
  same: el.ariaHidden === el.getAttribute("aria-hidden")
});
Try It Yourself

How It Works

Prefer ariaHidden in script; keep the attribute for HTML markup.

Example 5 — Support Snapshot

Feature-detect and list the allowed tokens.

JavaScript
console.log({
  supported: "ariaHidden" in Element.prototype,
  allowed: ["true", "false", "undefined"],
  tip: "Never leave focusable controls inside aria-hidden=\"true\"",
  status: "Baseline Widely available (MDN)"
});
Try It Yourself

How It Works

Use ariaHidden only when you intentionally want AT to skip content that may still be visible. For fully unused UI, prefer removing it or using inert / hidden.

🚀 Common Use Cases

  • Hiding decorative icons that duplicate adjacent text.
  • Exposing previously off-screen or modal backdrop content again.
  • Keeping visual-only flourishes out of the accessibility tree.
  • Toggling AT exposure when a panel becomes relevant.
  • Keeping script and markup aligned without manual setAttribute.

🔧 How It Works

1

Element may clutter the accessibility tree

Decorative or duplicate content does not need AT exposure.

Content
2

Set ariaHidden to true, false, or undefined

The property reflects aria-hidden for get and set.

Declare
3

Ensure no focusable traps remain

Hide or disable interactive descendants when AT-hiding a region.

Safety
4

Assistive tech skips or includes the element

Users hear meaningful content without decorative noise.

📝 Notes

  • Not Deprecated, Experimental, or Non-standard on MDN (Baseline Widely available).
  • aria-hidden is not a substitute for CSS hide or the HTML hidden attribute.
  • Never leave focusable content inside aria-hidden="true".
  • Related: ariaInvalid, ariaDisabled, EventTarget, JavaScript hub.

Browser Support

Element.ariaHidden is Baseline Widely available (MDN: across browsers since October 2023). Logos use the shared browser-image-sprite.png sprite from this project.

Baseline Widely available

Element.ariaHidden

String true / false / undefined — reflects aria-hidden for accessibility API exposure.

Baseline Widely available
Google Chrome Supported (ARIA reflection)
Yes
Microsoft Edge Supported (ARIA reflection)
Yes
Mozilla Firefox Supported (ARIA reflection)
Yes
Apple Safari Supported (ARIA reflection)
Yes
Opera Follow Chromium support
Yes
Internet Explorer No ariaHidden IDL — use setAttribute
No
ariaHidden Baseline

Bottom line: Use ariaHidden to control whether an element is exposed to accessibility APIs. Prefer removing or inerting unused interactive UI. Never leave focusable controls inside aria-hidden="true".

Conclusion

ariaHidden reflects aria-hidden so you can hide or expose an element in the accessibility tree with a string token. Use it carefully for decorative or duplicate content, keep focusable controls out of hidden subtrees, and prefer stronger hiding tools when interaction must stop too.

Continue with ariaInvalid, ariaDisabled, EventTarget, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Hide only decorative or truly redundant content
  • Keep an accessible name on the real control
  • Remove focus from descendants when hiding a region
  • Prefer inert / hidden when interaction must stop
  • Test with a screen reader after toggling exposure

❌ Don’t

  • Use aria-hidden as your only way to hide interactive UI
  • Leave buttons or links inside aria-hidden="true"
  • Hide the only copy of important information
  • Confuse AT hide with CSS display: none
  • Forget to restore "false" when content becomes relevant

Key Takeaways

Knowledge Unlocked

Five things to remember about ariaHidden

Reflected aria-hidden string for accessibility API exposure.

5
Core concepts
📝 02

Three tokens

true false undefined

Values
🔍 03

AT exposure

not CSS visibility

Rule
04

Baseline

widely available

Status
🎯 05

No focus traps

inside hidden subtrees

Safety

❓ Frequently Asked Questions

It reflects the aria-hidden attribute as a string, indicating whether the element is exposed to an accessibility API (hidden from AT, exposed, or left to the user agent).
No. MDN marks Element.ariaHidden as Baseline Widely available (since October 2023). It is not Deprecated, Experimental, or Non-standard.
The strings "true", "false", or "undefined". "true" hides the element from the accessibility API; "false" exposes it; "undefined" lets the user agent decide based on whether it is rendered.
No. CSS can hide content visually. aria-hidden="true" hides content from assistive technologies even if it remains visible on screen. Prefer removing or inerting content you do not want announced, and never leave focusable controls inside aria-hidden="true".
The element's hidden state for accessibility is determined by the user agent based on whether the element is rendered (MDN).
Yes. Reading and writing ariaHidden updates the reflected aria-hidden attribute.
Did you know?

Setting aria-hidden="false" can force an element into the accessibility tree even when browsers might otherwise treat it as not rendered—use it when you need AT to hear something that CSS has visually altered, and avoid it when content should stay out of both sight and AT.

Next: Element ariaInvalid

Learn the reflected aria-invalid property for validation state.

ariaInvalid →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful