Hidden Content – Incorrect Usage
Hidden content on a webpage is not supposed to be made available for screen reader users by default. It SHOULD be made available on user interaction in widgets such as Accordions, Tabs, and Menus.
NOTE:
- New to accessibility or uncertain of requirements, it will be helpful to review all sections below.
- Already familiar with requirements, skip to the “Working Example” section for sample HTML, CSS and JavaScript (when needed), along with a working demo.
-
The
aria-hidden
attribute is used to hide content on a webpage from screen readers. -
If content is to be hidden for all users, then it is advisable to use CSS
display: none
property or HTML hidden attribute. -
The
aria-hidden
attribute SHOULD NOT be used on interactive elements that are supposed be available for screen reader users. -
The
aria-hidden
attribute SHOULD NOT be used on content that is visible on the page. This may cause confusion for low vision users who use a screen reader. -
The
aria-hidden
attribute SHOULD primarily be used to hide content that is redundant content, decorative SVG images or content that appears on user interaction such as menus, accordion, and tabs.
For example,
<p>
<a href="https://www.pearson.com/en-gb/schools.html">Visit Schools UK</a>
<i class="fas fa-angle-right" aria-hidden="true"></i>
</p>
Content with correct usage of aria-hidden attribute majorly benefit the below users.
- People with visual disabilities
- People with limited dexterity
<h2>Discover our School offerings in your region</h2>
<div class="cards-container">
<div class="card">
<img loading="lazy" src="./UK-school-children.jpeg" alt="">
<div class="card-body">
<h3>Schools in the UK </h3>
<p>Explore our UK School offerings.</p>
<p>
<a href="https://www.pearson.com/en-gb/schools.html">Visit Schools UK</a>
<i class="fas fa-angle-right" aria-hidden="true"></i>
</p>
</div>
</div>
<div class="card">
<img loading="lazy" src="./teacher-and-student.jpeg" alt="">
<div class="card-body">
<h3>Schools in the US</h3>
<p>Explore our US School (K-12) offerings.</p>
<p>
<a href="https://www.pearson.com/en-us/schools/products-services/k12-online-schools.html">Visit Schools US</a>
<i class="fas fa-angle-right" aria-hidden="true"></i>
</p>
</div>
</div>
<div class="card">
<img loading="lazy" src="./students-working-with-tablet.jpeg" alt="">
<div class="card-body">
<h3>Schools in Canada</h3>
<p>Explore our Canadian School (K-12) offerings.</p>
<p>
<a href="https://www.pearson.com/en-us/schools/products-services/k12-online-schools.html">Visit Schools US</a>
<i class="fas fa-angle-right" aria-hidden="true"></i>
</p>
</div>
</div>
</div>
.cards-container {
display: flex;
flex-wrap: wrap;
padding: 20px;
}
.card {
max-width: 27rem;
background-color: #ffffff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
margin: 20px;
border-radius: 8px;
overflow: hidden;
transition: transform 0.3s ease-in-out;
padding: 20px 15px;
}
.card:hover { transform: scale(1.05); }
.card-header {
background-color: #3498db;
color: #ffffff;
padding: 15px;
text-align: center;
}
.card-body { padding: 20px; }
.card-footer {
background-color: #ecf0f1;
padding: 15px;
text-align: center;
}
.card img {
width: 100%;
height: auto;
border-radius: 8px 8px 0 0;
}
.fas, a {
color: #007a9c;
}