Using ARIA Hidden for Web Accessibility (2024)

In several past Accessibility Weekly posts, we’ve included an HTML attribute, aria-hidden=”true”, in code examples and mentioned that aria-hidden can be used to hide elements on a web page from screen readers. This post goes further into the aria-hidden element and when and why you might want to use it.

What is aria-hidden?

“aria-hidden” is an attribute that can be added to any HTML element to communicate to screen readers that the element should not be read out to screen reader users.

You can add aria-hidden=”true” onto a container like a div or a span, like this:

<span aria-hidden=”true”>Some content I want the screen reader to skip</span>

This will get the screen reader to ignore everything included in that container element and any children elements.

You can also add it to any individual element as mentioned in the Font Awesome and Icon Fonts Accessibility post RE icons or decorative images like this:

<img src=”/decorative-accent.svg” aria-hidden=”true”>

It is important to note that setting an element’s “aria-hidden” attribute to “true” is not the same as using display: none; in your CSS. Adding aria-hidden=”true” does not hide the element from sighted users. It hides it from screen reader users but still keeps it visible on the page.

Why hide things from screen readers?

When someone who is blind or has low vision visits a webpage, they want to find information or complete a transaction quickly, just like you or I would.

When designing websites, we add visual accents that make the website more interesting to look at – things like large quotation marks at the start of a block quote, borders, or small decorative icons on buttons or links. These decorative elements are usually easy for a sighted user to skim over or ignore as they read and engage with the website. However, unless we explicitly tell screen readers to ignore them, the screen reader will read all of these out with the rest of the content on the page.

Imagine going through a grid of posts and having to hear the post information, then “Read more. Image, right-pointing arrow” for every post on a page with 12 or more posts.

Using ARIA Hidden for Web Accessibility (1)

That “right-pointing arrow” is something that most sighted users will ignore. And for blind people, if read out, these icons present auditory clutter that slows down the user as they move through the page.

Hiding nonfunctional or uninformative, decorative things from screen readers can help screen reader users do what they want to do (and what you want them to do) on your website faster.

What should be hidden with aria-hidden?

Use aria-hidden=”true” to hide:

  • Purely decorative icons, images, or borders.
  • Repeated text or other duplicated content – sometimes it might make sense to add aria-hidden to linked images in a post grid if the title is also linked and the image provides no additional value.
  • Nonvisible or off-screen text, such as content in closed accordions, tabs, or navigation menu dropdowns.

Do not add aria-hidden=”true” to any elements that are able to receive keyboard focus, such as buttons or links, or that provide an important function on the web page. I’ve seen cases where people have incorrectly added aria-hidden to things that should not be hidden from screen reader users, which is why we warn about aria-hidden in Accessibility Checker.

How to add aria-hidden in WordPress

If you’re custom coding your HTML, it’s easy to add aria-hidden=”true” wherever you need it on the page. But when we use various builders, there are tricks to getting aria-hidden in the HTML.

Adding aria-hidden in the Block Editor

GenerateBlocks and Kadence Blocks are two popular block libraries that do a good job of adding aria-hidden=”true” to decorative icons automatically. Don’t try to use a WordPress core image block; flip to the code editor, and add it in yourself – you’ll get the dreaded “This block contains unexpected or invalid content” error, and the block recovery feature will strip it out.

The best bet in the block editor is selecting an existing block that already adds aria-hidden for you, or you can install the free Attributes for Blocks plugin that gives you the ability to define custom attributes on any block in the block editor.

Adding aria-hidden in Page Builders

Elementor

If you build websites with Elementor Pro, you can add aria-hidden to any widget with Elementor Pro’s custom attributes feature. Just go to Advanced > Attributes on the widget settings and type aria-hidden|true in the box. That will add aria-hidden=”true” to the top-level div for that widget, which will hide everything in it from screen readers. This is a great way to fix their (unlabeled) shape backgrounds feature, but use it carefully on a section or column, as it will hide everything in that section or column.

Bricks

There is also support for adding custom attributes on any element in Bricks. This feature can be found under Style > Attributes in the Bricks editor. It’s slightly more intuitive than Elementor, with separate fields for defining the attribute name and value and outputs on the element itself rather than on a parent container.

Oxygen

You can add custom attributes in Oxygen by going to Advanced > Attributes > Add Attribute on any element. Like in Bricks, there are separate fields for defining the name and value, and this outputs on the actual element, not a parent div.

Other Page Builders

Out of the box, Beaver Builder and Divi do not have support for custom attributes, so there isn’t an easy way to add aria-hidden in these builders. Beaver Builder has documentation on coding custom attributes onto modules, but there isn’t a no-code option I could find. There is a third-party add-on for adding custom attributes to Divi, but I didn’t test it.

Are you using a different page builder that supports custom attributes? Leave a comment on the Facebook post with what the builder is and how to add custom attributes.

Additional Resources

Using ARIA Hidden for Web Accessibility (2024)
Top Articles
The cheapest time to go to Orlando | Top Villas
Why you should make your adult kids pay rent to live in your house
Toa Guide Osrs
Encore Atlanta Cheer Competition
Edina Omni Portal
How Much Does Dr Pol Charge To Deliver A Calf
Hallowed Sepulchre Instances &amp; More
Skip The Games Norfolk Virginia
Premier Boating Center Conroe
Hallelu-JaH - Psalm 119 - inleiding
Nexus Crossword Puzzle Solver
Obituary | Shawn Alexander | Russell Funeral Home, Inc.
Indiana Immediate Care.webpay.md
Troy Athens Cheer Weebly
Breakroom Bw
Industry Talk: Im Gespräch mit den Machern von Magicseaweed
RBT Exam: What to Expect
6813472639
065106619
Parent Resources - Padua Franciscan High School
Der Megatrend Urbanisierung
Royal Cuts Kentlands
Att.com/Myatt.
Aspenx2 Newburyport
Apartments / Housing For Rent near Lake Placid, FL - craigslist
Access a Shared Resource | Computing for Arts + Sciences
Wku Lpn To Rn
Uno Fall 2023 Calendar
Guide to Cost-Benefit Analysis of Investment Projects Economic appraisal tool for Cohesion Policy 2014-2020
Mark Ronchetti Daughters
Opsahl Kostel Funeral Home & Crematory Yankton
Regis Sectional Havertys
Can You Buy Pedialyte On Food Stamps
888-333-4026
Encompass.myisolved
Thelemagick Library - The New Comment to Liber AL vel Legis
Questions answered? Ducks say so in rivalry rout
Costco Gas Foster City
Chase Bank Zip Code
Grand Valley State University Library Hours
Elven Steel Ore Sun Haven
Walmart Careers Stocker
Mcoc Black Panther
Who uses the Fandom Wiki anymore?
Jeep Forum Cj
Heat Wave and Summer Temperature Data for Oklahoma City, Oklahoma
Msatlantathickdream
Jigidi Jigsaw Puzzles Free
Parks And Rec Fantasy Football Names
Acellus Grading Scale
Latest Posts
Article information

Author: Chrissy Homenick

Last Updated:

Views: 6096

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Chrissy Homenick

Birthday: 2001-10-22

Address: 611 Kuhn Oval, Feltonbury, NY 02783-3818

Phone: +96619177651654

Job: Mining Representative

Hobby: amateur radio, Sculling, Knife making, Gardening, Watching movies, Gunsmithing, Video gaming

Introduction: My name is Chrissy Homenick, I am a tender, funny, determined, tender, glorious, fancy, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.