Modern website designs have become increasingly complex with multiple panes, headers, footers in addition to the main content itself. Sighted users can rely on visual conventions such as shadows, borders, and spacing to easily navigate these complex designs. Users that are visually impaired or blind rely on screen readers and keyboard navigation to quickly discover the content on a webpage. However, screen readers can only facilitate this user experience if webpages contain the appropriate markup.
In this guide, you will learn about how to use ARIA Landmarks effectively and concisely to convey the structure of your web page to assistive technologies like screen readers. Screen readers have hotkeys to cycle through the different landmarks on a page, so placing them thoughtfully in your webpages can make a big difference for the user experience of your website. Throughout this guide, we will use a blog as an example to illustrate how different landmark roles should be used. We will begin by introducing the most commonly used landmark roles and then put it all together in an HTML document outline.
When a user navigates to a webpage on your blog, perhaps by referral from a Google search result, they likely want to read a blog post itself. However, for branding and consistency purposes, you may have a header, navigation links, a sidebar, and maybe a headshot displayed before the main content of the page. You do not want to force screen-reader users to tab through all this before they can get to the article. The content that is repeated on all pages of your blog should be structurally demarcated from the main content, i.e., the article itself. This is the intended use for the main landmark role—it indicates the section of the page that represents the blog article.
The main landmark role is identified by the
<main /> HTML 5 semantic tag.
Your blog may also have supporting content such as:
These two sections are examples of
complemetary content and can be identified in HTML by the
<aside /> HTML 5 semantic tag. These sections support the blog article, but are not the main content itself.
Using ARIA landmarks is straightforward using HTML semantic tags.
The code snippet below demonstrates how you can use the
<aside />, and
<nav /> landmarks discussed above in your blog's HTML.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
<body> <nav> <ul> <li><a href="/top-articles">Top Articles</a></li> <li><a href="/about-me">About me</a></li> <li><a href="/archive">Archive</a></li> </ul> </nav> <main> <h1>Using Landmarks to Make Your Website Screen Reader-Friendly</h1> <p>...</p> <p>...</p> <p>...</p> <p>...</p> <p>...</p> </main> <aside aria-label="related articles"> <ul> .... </ul> </aside> <aside aria-label="page actions"> <h2>Is this article helpful?</h2> <button aria-label="up vote" onClick="upVote()">+</button> <button aria-label="down vote" onClick="downVote()">-</button> </aside> </body>
Note that there are two
<aside /> HTML tags. In order to help screen-reader users quickly distinguish the two landmarks, you can also add
aria-label to name these sections. When they are labeled, the screen reader NVDA will read aloud:
complementary landmark page actions
In this guide, you learned about main, complementary, and navigation landmarks. These are the primary landmarks that most web page designs should use. Adding the appropriate HTML semantic tags communicates the structure of your webpage to assistive technologies.
As a final note, you should remember:
<nav />tags are the most important navigation roles you can add.
<main />tag, and it should not be nested in another landmark.