Exercise objective
In this exercise, you’ll identify and fix landmark element issues in a deliberately broken page. This will help you understand the importance of proper semantic HTML structure for screen reader users.The challenge
Navigate to the Broken Landmarks page in the course demo site:Make sure you have the development server running with
bun run dev before accessing this page.What’s wrong?
The page looks fine visually, but has serious structural problems that affect accessibility:- Generic
<div>elements instead of semantic landmarks - Missing or incorrect landmark elements
- No clear page structure for screen readers
- Poor navigation experience for assistive technology users
What are landmarks?
Landmark elements provide a way to identify and navigate major sections of a page. Screen readers use them to help users quickly jump between different areas.Key landmark elements
<header>
Contains the site banner, logo, and main navigation. Usually appears at the top of the page.
<nav>
Contains navigation links, either primary site navigation or secondary navigation menus.
<main>
Contains the primary content of the page. There should only be one
<main> element per page.<footer>
Contains footer information like copyright, contact info, and secondary links.
<section>
Represents a thematic grouping of content, typically with a heading.
<aside>
Contains tangentially related content, like sidebars or pull quotes.
Your task
Examine the broken page
Open
src/pages/broken-landmarks.html in your code editor and inspect the HTML structure.What you'll see
What you'll see
The page uses
<div> elements where semantic landmarks should be:Test with a screen reader
Open the page with a screen reader and test the landmark navigation:
- NVDA (Windows)
- JAWS (Windows)
- VoiceOver (macOS)
- Press
Dto cycle through landmarks - Press
Insert + F7to open the Elements List - Select “Landmarks” to see all landmarks on the page
Complete solution
Here’s the corrected structure:broken-landmarks.html
Testing your solution
Browser DevTools
Most modern browsers show landmark structure:Chrome DevTools
Chrome DevTools
- Open DevTools (F12)
- Go to the Elements tab
- Look for the Accessibility pane (you may need to enable it)
- Expand the Accessibility tree to see landmarks
Firefox DevTools
Firefox DevTools
- Open DevTools (F12)
- Go to the Accessibility tab
- View the Accessibility tree to see landmark structure
Automated testing
You can also use automated tools:Best practices
Use one
<main> per page - There should only be one main landmark that contains the primary content.Include a skip link - Always provide a “Skip to main content” link at the top of the page.
Use
<nav> for navigation - Wrap navigation menus in <nav> elements, not just <ul> lists.Label multiple landmarks of the same type - If you have multiple
<nav> elements, use aria-label or aria-labelledby to distinguish them.Keep heading hierarchy - Use proper heading levels (h1, h2, h3) to structure content within landmarks.
Why landmarks matter
Screen reader users often navigate by landmarks rather than reading the entire page. Without proper landmarks, they must read through all content linearly, which is time-consuming and frustrating.
- Quickly jump to the main content
- Skip repetitive navigation
- Navigate between major page sections
- Understand the page structure at a glance
Learn more
Landmark patterns
Learn more about landmark elements and when to use them
Semantic HTML
Understand the importance of semantic HTML for accessibility
Congratulations!
You’ve completed all three exercises. You now understand:- How to respect user motion preferences
- Why native HTML elements are important
- How to structure pages with proper landmarks