Anatomy
Breadcrumbs are made of links (indicating parents), dividers, and the current page. The default breadcrumbs component can be modified to change the number of items within the chain.
Examples
Options
Breadcrumb length
By default the breadcrumbs component can show up to 10 items within the chain.
Accessibility and usability expectations
Breadcrumbs provide users with a structured set of links to both help them understand where they are within the context of a site, and to allow them to more easily jump directly to previous sections within the site''s structure.
The last item in the breadcrumb trail refers to the current page. To convey this visually, the link is styled differently from the preceding links. For screen reader users, this information is conveyed programmatically through the use of the aria-current
attribute in the rendered output.
Built-in accessibility features
This component is rendered as a <nav>
navigation landmark region, with an accessible name of "Breadcrumbs".
This makes the breadcrumb navigation easily discoverable for screen reader users who navigate via page landmarks.
Implementation requirements
In the Rails implementation, the link in the last item is automatically given an aria-current="page"
.
In the current React implementation, you need to explicitly mark the last item as selected
, which results in aria-current="page"
being added to the link.
How to test the component
Integration tests
- Each breadcrumb link has appropriate and descriptive link text
- For the React implementation, the last breadcrumb item has been explicitly marked as
selected
, to visually and programmatically identify it as a link referring to the current page
Component tests
- The breadcrumb component is exposed as a navigation landmark with an appropriate name/label
- The breadcrumb items have an appropriate structure, such as an
<ol>
ordered list - For the Rails implementation, the last item link is programmatically identified as a link to the current page using
aria-current="page"
- For the React implementation, if a breadcrumb item has been marked as
selected
, the last item link in the rendered output is programmatically identified as a link to the current page usingaria-current="page"