Accessible Breadcrumb Navigation Pattern
Published: April 3, 2017
Last updated: December 11, 2021
Examples of a breadcrumb navigation using
aria-label to provide an accessible name, and
aria-current to indicate the currently active link.
Example: using "
aria-current=page" on last link
Example: using "
aria-current=location" on last link
Example: using "
aria-current=location" on last list item
<nav class="breadcrumb-nav" aria-label="Breadcrumb"> <ol> <li> <a href="/"> Index </a> </li> <li> <a href="/pg2"> Second Page </a> </li> <li> <a href="/pg2/this-pg" aria-current="page"> <!-- or "location" --> This Page </a> </li> </ol> </nav> <nav class="breadcrumb-nav" aria-label="Breadcrumb example 2"> <ol> <li> <a href="#"> Index </a> </li> <li> <a href="#"> Second Page </a> </li> <li aria-current="location"> This Page </li> </ol> </nav>
Breadcrumbs are useful on large websites where pages have clearly defined hierarchy. These navigation patterns can allow users to easily backtrack through related pages, or the pathway they had taken to reach the current page.
Breadcrumbs aren't meant to be used for single-level websites, where there are no logical groupings of related content. For slightly more complex websites, where there may only be some instances of leveled navigation groupings, breadcrumbs may still not be necessary if they don't provide much in the way of a simplified user experience over using the primary navigation.
Screen Reader Announcements?
You may notice that the dividers between each link/list item of the breadcrumb are created via CSS pseudo elements. Originally I had used CSS
content: "/\00a0"; with
speak: none; as a divider. However, even though added by CSS, screen readers like NVDA would announce the "slash" if navigating by list items, and VoiceOver would even move focus to the "/" if navigating with VO + left/right arrow keys.
speak: none has no practical support, which is unfortunate.
Using CSS to create a arrow/triangle (or any other sort of divider that can be made with CSS alone) will allow for a visual separator that won't be announced by a screen reader. It also won't require additional list items containing the divider, or a
<span> containing something like a "/" to be added to each necessary list item, just to then be hidden with
aria-hidden="true" so it's not announced or included in the number of items in the list.
macOS and iOS will not report a
<ol> as a list when removing its default list markers. A `role=list` can be added to the
<ol> element to make sure the announcement of the list remains.
Note that screen reader support for
aria-current is rather good. As of Dec 2021, most gaps in implementation support have been filled. If you find a screen reader / browser pairing that does not support
aria-current, you should file a bug.
Being that a breadcrumb is contained within a
nav element, it will be surfaced as a landmark to screen readers. Providing it an accessible name of "breadcrumb" (or whatever term may be more meaningful to your site) will help differentiate it from any other navigation landmarks in the current document, such as the "primary" navigation.
The last link in the breadcrumb should have the
aria-current attribute, which either have the value of
location. The value you choose is largely up to you since both make sense in the context of the breadcrumb pattern. e.g., the last link in the breadcrumb is the current "page", while also serving as the current "location" in the breadcrumb trail. Note that if using
aria-current in primary navigation patterns, the
page value is what would be expected there.
Some other breadcrumb patterns remove the
<a> element, or at least the
href from the link. This is demonstrated in the third example, where the first two examples keep the last item in the breadcrumb as a hyperlink. One reason to keep the hyperlink is so that people using a screen reader and navigating by links, or via focusable content with the tab key would not come across the currently active link. The counter argument for using a hyperlink in the last breadcrumb list item is that, since it represents the current page, there's little reason to include it in the document's keyboard focus order.
For more information about the
aria-current attribute, read
aria-current attribute by Léonie Watson.