== Why is this an issue?

Header 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, header 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 headers, screen readers can give users an overview of the content and allow them to jump to the section they're interested in.

If a header 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 header elements.

== How to fix it

Do not leave empty your header elements.

=== Code examples

==== Noncompliant code example

[source,javascript,diff-id=1,diff-type=noncompliant]
----
function JavaScript101() {
    return (
        <>
            <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

[source,javascript,diff-id=1,diff-type=compliant]
----
function JavaScript101() {
    return (
        <>
            <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

* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements[Heading elements]
* MDN web docs - https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden[aria-hidden]
* WCAG - https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-descriptive.html[Headings and Labels]
