All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.web.rules.Web.S6850.html Maven / Gradle / Ivy

The newest version!

Why is this an issue?

Heading elements are represented by the tags <h1> through <h6>, with <h1> being the highest level and <h6> being the lowest. These elements are used to structure the content of the page and create a hierarchical outline that can be followed by users and search engines alike.

In the context of accessibility, heading elements play a crucial role. They provide a way for users, especially those using assistive technologies like screen readers, to navigate through the content of a webpage. By reading out the headings, screen readers can give users an overview of the content and allow them to jump to the section they’re interested in.

If a heading element is empty, it can lead to confusion as it doesn’t provide any information about the content that follows. This can make navigation difficult for users relying on screen readers, resulting in a poor user experience and making the website less accessible for people with visual impairments.

Therefore, to ensure your website is accessible to all users, it’s important to always include meaningful content in your heading elements.

How to fix it

Do not leave empty your heading elements.

Code examples

Noncompliant code example

<h1>JavaScript Programming Guide</h1>
<p>An introduction to JavaScript programming and its applications.</p>

<h2>JavaScript Basics</h2>
<p>Understanding the basic concepts in JavaScript programming.</p>

<h3>Variables</h3>
<p>Explanation of what variables are and how to declare them in JavaScript.</p>

<h3 aria-hidden>Data Types</h3> <!-- Noncompliant -->
<p>Overview of the different data types in JavaScript.</p>

<h3 /> <!-- Noncompliant -->
<p>Understanding how to declare and use functions in JavaScript.</p>

Compliant solution

<h1>JavaScript Programming Guide</h1>
<p>An introduction to JavaScript programming and its applications.</p>

<h2>JavaScript Basics</h2>
<p>Understanding the basic concepts in JavaScript programming.</p>

<h3>Variables</h3>
<p>Explanation of what variables are and how to declare them in JavaScript.</p>

<h3>Data Types</h3>
<p>Overview of the different data types in JavaScript.</p>

<h3>Functions</h3>
<p>Understanding how to declare and use functions in JavaScript.</p>

Resources

Documentation





© 2015 - 2025 Weber Informatics LLC | Privacy Policy