Landmarks ARIA

Introduction

In this example, we'll see how to improve page navigation by adding semantics to content that makes it easier to find the major regions of the page.

Theory

HTML5 introduces new tags, including semantic tags (main , aside , footer , and header , ...).

These tags should be used alone without the corresponding ARIA roles because their support is good in the vast majority of browsers and assistive devices.

For a page in HTML5:

  <head>
    …
    <title>Titre de la page</title>
    …
  </head>
  <body>
    <header>
      <h1>…</h1>
      <nav>…navigation…</nav>
      <p>page header : logo, baseline…</p>
      …
    </header>
    <main>
       <nav aria-label="Breadcrumb">[…]</nav>
       <section>
         <header>
           <h1>News</h1>
           <p>June 21th, 2018 - Music festival</p>
         </header>
         <p>section's content</p>
         <footer>
           <p>section footer content  : copyright…</p>
           …
         </footer>
      </section>
      <article>
      […]
      </article>

      […]

    </main>
    <aside>
      <p>aside's content</p>
      […]
    </aside>
    <footer>
      <p>footer content : copyright…</p>
      […]
    </footer>
  </body>
  
For a page that is not in HTML5, add the landmarks ARIA:

<head>
    …
  <title>Page title</title>
    …
</head>
<body>
    <div role="banner">
      <h1>…</h1>
      <div role="navigation">…navigation…</div>
      <p>page header : logo, baseline…</p>
      …
    </div>
  <div role="main">
  <div role="navigation" aria-label="Breadcrumb">[…]</nav>
    <div role="region">
      <div role="header">
        <h1>News</h1>
        <p>June 21th, 2018 - Music festival</p>
      </header>
      <p>region's content</p>
      <div role="contentinfo">
        <p>region footer content : copyright…</p>
      </div>
    </div>
    <div role="article">
    […]
    </div>

  […]

  </div>
  <div role="complementary">
    <p>aside's content</p>
      […]
    </div>
  <div role="contentinfo">
    <p>footer content : copyright…</p>
      […]
  </div>
</body>
 

Usage

Best practice

All these landmarks can rely on the ARIA attributes that are aria-label, aria-labelledby and aria-describedby to provide them with a more relevant accessible name.

Especially when several landmarks of the same type are present in the page, it may be important to give them a description via these ARIA attributes.

Example of a page with three navigation regions:


 <nav aria-label="Main Menu"> [...] </nav >
 <nav aria-label="Secondary Menu"> [...] </nav>
 <nav aria-label="breadcrumb trail"> [...] </nav>

More details on "The ARIA attributes that can save you" .

Another best practice is that all content must be included in the Landmarks / HTML5 structure tags. This allows users to not forget content that they would not have found.

Landmarks, users and assistive devices

The HTML5 tags defining the main regions of the page have sufficient support with assistive technologies (screen readers, magnifying software...). We must therefore use them to structure his page without adding roles Landmarks.

Setting up these landmarks ARIA is a good practice, because it can improve the browsing of some users without impacting that of others. It's really a best practice!