Complete the code to define the main content area using a semantic element.
<[1]> <p>This is the main content of the page.</p> </[1]>
The <main> element defines the main content area of a page, which helps screen readers understand the primary content.
Complete the code to add an accessible label to the navigation using ARIA.
<nav aria-[1]="Primary navigation"> <ul> <li><a href="#home">Home</a></li> <li><a href="#about">About</a></li> </ul> </nav>
The aria-label attribute provides an accessible name for the navigation landmark, helping screen readers announce it properly.
Fix the error in the heading structure to improve screen reader navigation.
<h1>Welcome</h1> <[1]>Subheading</[1]>
Headings should follow a logical order. After <h1>, the next level should be <h2> for proper screen reader navigation.
Fill both blanks to create a section with a heading and an accessible description.
<section aria-[1]="section1-title"> <h2 id="section1-title">Features</h2> <p id="section1-desc">[2]</p> </section>
The aria-labelledby attribute links the section to a description or title by ID, improving screen reader context. The paragraph provides a clear description.
Fill all three blanks to create a footer with proper semantic element, role, and accessible label.
<[1] role="[2]" aria-[3]="Site footer"> <p>Ā© 2024 My Website</p> </[1]>
The <footer> element defines the page footer. The role="contentinfo" helps screen readers identify it as footer content. The aria-label gives it a clear accessible name.
Practice
Solution
Step 1: Understand the purpose of semantic elements
Semantic elements describe the role of content, helping screen readers know what is important.Step 2: Identify the element for main content
The<main>element specifically marks the main content unique to the page, guiding screen readers effectively.Final Answer:
<main> -> Option AQuick Check:
Main content uses <main> tag for screen readers [OK]
- Using <div> which has no semantic meaning
- Confusing <section> with main content
- Using <span> which is inline and non-semantic
Solution
Step 1: Recall the semantic tag for navigation
The<nav>element is the standard semantic tag for navigation menus.Step 2: Check syntax correctness
<nav> ... </nav>is valid HTML5 syntax recognized by screen readers.Final Answer:
<nav> ... </nav> -> Option AQuick Check:
Navigation uses <nav> tag [OK]
- Using non-existent <navigation> tag
- Confusing <menu> with <nav> (menu is different)
- Using <section> without role attribute
<header> <h1>Welcome</h1> </header> <main> <p>Hello world!</p> </main>
Solution
Step 1: Understand screen reader reading order
Screen readers read semantic elements in document order, starting with header content.Step 2: Identify first readable text
The<header>contains an<h1>with "Welcome", so it reads this first.Final Answer:
"Welcome" from the header's h1 -> Option DQuick Check:
Header content is read before main content [OK]
- Assuming main content reads first
- Thinking header is skipped
- Believing screen reader reads all at once
<div role='main'> <h2>Content</h2> </div>
Solution
Step 1: Check semantic correctness
Whilerole='main'can be used, the semantic<main>element is preferred for accessibility.Step 2: Understand best practice for screen readers
Using<main>provides built-in semantic meaning and better support than adivwith role.Final Answer:
Usingrole='main'on adivinstead of<main>-> Option BQuick Check:
Use <main> tag, not div with role [OK]
- Thinking role='main' on div is equal to <main>
- Ignoring heading level importance
- Adding tabindex unnecessarily
Solution
Step 1: Identify semantic element for complementary content
The<aside>element is designed for complementary content like sidebars.Step 2: Check ARIA attribute necessity
<aside>already implies complementary role, so extra ARIA roles are unnecessary and may confuse screen readers.Final Answer:
<aside> without extra ARIA attributes -> Option CQuick Check:
Use <aside> for complementary content [OK]
- Adding redundant ARIA roles to <aside>
- Using <section> or <div> without semantic meaning
- Confusing <nav> with sidebar role
Ready to prove it?
Pass the test and this pattern moves unknown
