-
Notifications
You must be signed in to change notification settings - Fork 176
/
S6850.html
68 lines (59 loc) · 3.5 KB
/
S6850.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<h2>Why is this an issue?</h2>
<p>Header elements are represented by the tags <code><h1></code> through <code><h6></code>, with <code><h1></code> being the highest
level and <code><h6></code> 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.</p>
<p>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.</p>
<p>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.</p>
<p>Therefore, to ensure your website is accessible to all users, it’s important to always include meaningful content in your header elements.</p>
<h2>How to fix it</h2>
<p>Do not leave empty your header elements.</p>
<h3>Code examples</h3>
<h4>Noncompliant code example</h4>
<pre data-diff-id="1" data-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>
</>
);
}
</pre>
<h4>Compliant solution</h4>
<pre data-diff-id="1" data-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>
</>
);
}
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
<li> MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements">Heading elements</a> </li>
<li> MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-hidden">aria-hidden</a> </li>
<li> WCAG - <a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/navigation-mechanisms-descriptive.html">Headings and Labels</a> </li>
</ul>