navigation

Term side of the Card.
Topic: Structural Elements
Unit title: navigation
Categories: Role
Explanation side of the Card

Explanation: The role used to identify a section of a page that contains navigation links or menus. It helps users quickly locate and access different parts of the site or application.

Example

Wronghtml
<nav role="navigation">
  <a href="/">Home</a>
</nav>
<nav role="navigation">
  <a href="/terms">Terms</a>
</nav>
Righthtml
<nav aria-label="Main">
  <a href="/" aria-current="page">Home</a>
</nav>
<nav aria-label="Footer">
  <a href="/terms">Terms</a>
</nav>

Native <nav> needs no role, and unique labels let users tell the landmarks apart.

Common mistakes

  • Wrapping every group of links in <nav>, so the landmark list is noisy.
  • Labels like 'Main navigation', read as 'Main navigation navigation'.

Key points

  • Navigation uses <nav> without a redundant role="navigation".
  • Each <nav> has a unique aria-label when there is more than one.
  • Labels do not include the word 'navigation', since screen readers already say it.
  • The current page link has aria-current="page".

Interview questions

Should every list of links be in a <nav>?

No. Use <nav> for major navigation blocks only, like the main menu or breadcrumbs.

Should a <nav> contain a <ul>?

It is common and helpful, since screen readers announce the number of links.

Analytics cookiesWe'd like to use analytics cookies to see which pages are useful. They're set only if you accept. Privacy Policy