Hi all, I’m just reading a bit online about Aria roles and it seems a bit contradictory what I’m reading.
This tutorial :
has this code bit:
<nav role="navigation">
while here:
https://www.w3.org/TR/html-aria/#docconformance
it clearly explains that implicit Aria semantics should not be used:
as in: nav
role=navigation
So what am I missing here ?
Thanks
In practice screen reader software understands that nav
is navigation so the role is redundant in most cases, but “navigation” is supposed to be a landmark role, so if you had multiple nav elements, then that would be the main nav. Multiple elements with a role of navigation are supposed to be given unique label as well – but you could just have nav elements with aria-labelledby applied to them. You can add the role to any list of links you want to use as a landmark, so the snippet acts as a (confusing) example. Better examples:
https://www.w3.org/TR/wai-aria-practices/examples/landmarks/navigation.html
Thank you for the reply. I will take a look at this
Oke , so instead of coding this:
<div role="navigation" aria-labelledby="nav1">
<h2 id="nav1">title for navigation area 1<h2>
<!--rest of code-->
</div>
I could code this:
<nav aria-labelledby="nav1">
<h2 id="nav1">title for navigation area 1<h2>
<!--rest of code-->
</nav>
or in the case if it’s just one navigation group:
<div role="navigation">
<!--rest of code-->
</div>
or:
<nav>
<!--rest of code-->
</nav>
would that be correct ? Thanks