Headings Hierarchy

Use proper heading levels (h1-h6) to create a logical document outline that screen reader users can navigate.

beginner
1.3.1 Info and Relationships (Level A)2.4.1 Bypass Blocks (Level A)2.4.6 Headings and Labels (Level AA)
❌

The Bad (Inaccessible)

<div class="page">
  <p class="large-text bold">Welcome to Our Store</p>
  <p class="medium-text bold">Featured Products</p>
  <div class="product">
    <p class="small-text bold">Wireless Headphones</p>
    <p>Premium audio experience.</p>
  </div>
  <p class="large-text bold">About Us</p>
</div>
βœ…

Accessibility-Ready Code

<main>
  <h1>Welcome to Our Store</h1>

  <section>
    <h2>Featured Products</h2>
    <article>
      <h3>Wireless Headphones</h3>
      <p>Premium audio experience.</p>
    </article>
  </section>

  <section>
    <h2>About Us</h2>
    <!-- content -->
  </section>
</main>

The Standard

Headings (<h1> through <h6>) create a document outline that screen reader users navigate like a table of contents. Skipping levels or using styled text instead breaks this navigation.

WCAG Criteria

  • 1.3.1 Info and Relationships (Level A): Structure must be programmatically determinable.
  • 2.4.1 Bypass Blocks (Level A): Headings help users skip to content sections.
  • 2.4.6 Headings and Labels (Level AA): Headings must describe their section.

❌ The Bad (Inaccessible)

What’s Wrong?

  1. No Semantic Headings: Screen readers cannot build a page outline from styled <p> tags.
  2. No Navigation: Users cannot jump between sections using heading shortcuts.
  3. β€œH” Key Useless: Screen reader users press β€œH” to jump to headingsβ€”this fails completely.

βœ… The Good (Accessibility-Ready Code)

Why This Works

  1. Clear Hierarchy: h1 > h2 > h3 creates a logical tree structure.
  2. Quick Navigation: Screen readers list all headings in order for easy jumping.
  3. Single <h1>: Each page has one main titleβ€”the page topic.

Accessibility Checklist

  • Use exactly one <h1> per page for the main title.
  • Never skip heading levels (e.g., h1 β†’ h3).
  • Use headings to introduce sections, not for styling.
  • Ensure heading text describes the section content.
  • Test with a screen reader’s heading navigation (press β€œH”).
πŸ“ Perfect Implementation Reference
<main>
  <h1>Page Title</h1>
  <section>
    <h2>Section Level 1</h2>
    <article>
      <h3>Subsection Level 2</h3>
    </article>
  </section>
</main>

Technical Deep Dive

The Accessibility Tree

Heading Level 1: "Welcome to Our Store"
β”œβ”€β”€ Heading Level 2: "Featured Products"
β”‚   └── Heading Level 3: "Wireless Headphones"
└── Heading Level 2: "About Us"

Screen Reader Behavior

  1. β€œH” Key: Jumps to next heading at any level.
  2. β€œ1-6” Keys: Jump to specific heading levels (e.g., press β€œ2” for next <h2>).
  3. Rotor/Elements List: Displays all headings in a navigable list.
πŸ§ͺ

Interactive Behavioral Lab

πŸ’»

Interactive Sandbox

LIVE PREVIEW

πŸ”¬ Technical Internals

Understand how this component is processed by the browser and Assistive Technology (AT). This section bridges the gap between visual code and the hidden logic that powers accessibility.

🌲 Accessibility Tree

The data structure used by screen readers to "see" your page. It translates HTML roles and attributes into standardized objects.

βš™οΈ Event Logic

Expected behavioral standards for keyboard navigation and state transitions. Crucial for users who don't use a mouse.

  • Focus: Highlights via :focus-visible
  • Activation: Responds to Enter and Space
  • Role: Identified as Heading Pattern

🌐 Browser & Screen Reader Compatibility

Browser
Screen Reader
Status
🍎 Safari
VoiceOver
βœ“ Safe
πŸͺŸ Chrome
NVDA
βœ“ Safe
πŸͺŸ Edge
JAWS
βœ“ Safe
🦊 Firefox
NVDA
βœ“ Safe
πŸ“± iOS Safari
VoiceOver
βœ“ Safe
πŸ€– Chrome Android
TalkBack
βœ“ Safe