Skip to content
easeweb
Search topics

Headings that don't match the page's sections

A recipe page styles its section titles as divs and uses headings for a small title and a rule, so a screen reader's headings list misses the sections.

WCAG 2.2
SC 1.3.1ASC 2.4.6AA
Required by
Section 508 · EN 301 549 (EU)
Broken <div class="section-title">Method</div>
The accessibility problem illustrated: No vision:Where is the Method?
01

The problem

Screen reader users can't skim the page by its headings, because the main sections aren't headings at all, and some of the headings that are don't say what follows

02

Try it

Use the headings list to jump to the method

The list shows the headings a screen reader finds on this recipe page, and the tag beside each title shows its markup. Choose an entry to jump to it. Can you reach Method, and does each entry say what its section holds?

Broken Can you fix this?

BrokenTitles marked up for their look
Lentil soup<h1>

A thick, warming soup for weeknights.

<h2>
Ingredients<div>
  • 1 onion
  • 2 carrots
  • 200 g red lentils
  • 1 litre vegetable stock
Method<div>
  1. Soften the onion and carrots.
  2. Add the lentils and stock.
  3. Simmer for 25 minutes, then blend.
Tips<h5>

A squeeze of lemon brightens it.

More<h2>
  • Tomato soup
  • Pea soup
  • Leek and potato soup

Screen reader’s headings list:

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Mark each section title as a heading at the right level

Before
BrokenTitles marked up for their look
<h1>Lentil soup</h1><p>A thick, warming soup for weeknights.</p><h2 class="divider"></h2> <div class="section-title">Ingredients</div><ul>…</ul> <div class="section-title">Method</div><ol>…</ol><h5>Tips</h5><p>…</p> <h2>More</h2><ul class="cards">…Tomato soup, Pea soup, Leek and potato soup…</ul>
What is wrong4 points
  • Ingredients and Method are missing from the headings list. They are div elements styled large and bold, so the two main sections have no heading.
  • The headings list has a stop with no text. The only level 2 heading before the sections is the empty h2 drawn as a rule.
  • Tips is listed deeper than it sits on the page. It is an h5, a depth its place inside Method doesn't have.
  • More doesn't say what it introduces.
After

Heading elements at the right level

<h1>Lentil soup</h1><p>A thick, warming soup for weeknights.</p> <h2 class="section-title divider">Ingredients</h2><ul>…</ul> <h2 class="section-title">Method</h2><ol>…</ol><h3 class="title-small">Tips</h3><p>…</p> <h2 class="section-title">More soup recipes</h2><ul class="cards">…Tomato soup, Pea soup, Leek and potato soup…</ul>
How it is fixed4 steps
  1. Make Ingredients and Method h2 elements. The section-title class keeps them exactly the size they were, because the size never depended on the element.
  2. Make Tips an h3 inside Method, with a class for its size.
  3. Remove the empty h2, and draw the rule as a border on the first section title, so it no longer adds an empty stop.
  4. Rename More to More soup recipes, a level 2 heading.

Ingredients, Method and More soup recipes are now level 2 headings under the page title, and Tips is a level 3 heading inside Method, so the headings list reads like the page. This fixes the Before and passes 1.3.1 and 2.4.6. A heading's default size and margin, the first reason below for keeping a div, are set by the class here too.

Why this fix: Use native HTML first

04

Verify the fix

4 checks, no mouse.

Test with: Screen reader

0 of 4 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat whenever a template, a shared heading component or the CMS editor's styles change.

Limits

This is a starting pattern, not a guarantee for every application. Class names, colours and the … in the lists are placeholders. Screen readers word the headings list differently, so listen for the titles and levels rather than the exact phrasing. This guide covers whether titles are headings, their levels and their words. It doesn't cover the labels on form fields, or whether long content has headings in the first place, which is in long pages with no subheadings. Test the complete journey with your target assistive technology.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service