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.Going from using a screen reader and reading this blog post, the rel
attributes won't make a difference to A.T. As for using aria-level
, it works if you put it on the anchor tags. I'd also advise wrapping the list in a nav
element, for semantic purposes and to save the need of putting a navigation role on the list when you don't need to.
I wound up with this markup for what I think is a not-too-bad breadcrumb. Hide the bullets using CSS (I didn't stop to do that I'm afraid) and I'd say its good.
<nav aria-label="breadcrumb" role="navigation">
<ul>
<li><a href="#" aria-level="1">Home</a></li>
<li><a href="#" aria-level="2">News</a></li>
</ul>
</nav>
Hope this helps!
You can use like below
<nav role="navigation" aria-label="breadcrumbs">
<p id="breadcrumblabel">You are here:</p>
<ol id="breadcrumb" aria-labelledby="breadcrumblabel">
<li><a href="index.html" title="Home">Home</a></li>
<li><a href="products.html" title="Menu1">Menu1</a></li>
<li><a href="shoes.html" title="Menu2">Menu2</a></li>
</ol>
</nav>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With