What can be done to improve the accessibility of a breadcrumb menu similar to:
<ul class="breadcrumbs" aria-label="breadcrumb navigation" role="navigation">
<li><a href="~/">Home</a></li>
<li><a href="~/news">News</a></li>
<li class="unavailable"><a href="#">@Model.Title</a></li>
</ul>
Given in this example Home is the site root, News is the first child, and the unavailable class is the current item the /news/article item.
Is there anything that could be done to improve this such as using rel
attributes or aria-level
attributes?
I would avoid the use of aria-level
and use a <ol>
element instead. It is best to avoid using aria attributes wherever a native alternative exists. Using aria adds an extra layer of complexity. Simple HTML is far better and already has semantics that are surfaced to AT. This is the first rule of ARIA.
Borrowing from the WAI-ARIA-Practices document, breadcrumbs would look like something like this:
<nav aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="../../">
WAI-ARIA Authoring Practices 1.1
</a>
</li>
<li>
<a href="../../#aria_ex">
Design Patterns
</a>
</li>
<li>
<a href="../../#breadcrumb">
Breadcrumb Pattern
</a>
</li>
<li>
<a href="./index.html" aria-current="page">
Breadcrumb Example
</a>
</li>
</ol>
</nav>
Some notes:
<nav>
element lets screen reader users quickly find and jump to the breadcrumbs.<ol>
element surfaces an order to screen reader users.<ol>
should be a child of the <nav>
. Some implementations apply role="nav"
to the <ol>
itself. This is wrong and will override the default <ol>
semantics. aria-current
informs screen reader users that this is the current page. If the last breadcrumb for the current page is not a link, the aria-current
attribute is optional.