ARIA Landmark Roles
You'll learn how to apply ARIA landmark roles to non-semantic elements so screen reader users can navigate your page structure effectively.
What Are ARIA Landmark Roles?
Think of landmark roles as putting up clear signage in a building. Just as signs help visitors find the lobby, restrooms, or exits, landmark roles help screen reader users jump directly to major sections of your webpage.
You've already learned about HTML5 semantic elements like <header>, <nav>, and <main>. But what if you're stuck with a <div> and can't change it? That's where ARIA landmark roles come in — they add the same navigational meaning to non-semantic elements.
When to Use ARIA Landmark Roles
If you're using semantic HTML, you typically don't need these. But sometimes you inherit legacy code or work with constraints where <div> or <span> elements are already in place. ARIA landmark roles let you fix accessibility without restructuring your markup.
Key Landmark Roles
Here's how you'd apply them to <div> elements:
<div role="banner"><!-- Site header --></div>
<div role="navigation"><!-- Main menu --></div>
<div role="main"><!-- Primary content --></div>
<div role="complementary"><!-- Sidebar --></div>
<div role="contentinfo"><!-- Footer --></div>
<div role="search"><!-- Search form --></div>
These roles mirror the semantic HTML elements you've learned: role="banner" = <header>, role="navigation" = <nav>, role="main" = <main>, and so on.
Remember the First Rule
This is an exception to "The First Rule of ARIA: Don't Use ARIA." Use semantic HTML when possible, but when you can't, landmark roles provide screen readers with the structural navigation they need.
Key Takeaway: ARIA landmark roles add navigational semantics to non-semantic elements, enabling screen reader users to jump between major page sections just like they would with proper HTML5 landmarks.