How to make aria labels work? #15161
DescriptionI have been using _quarto.yml project:
type: website
website:
navbar:
left:
- text: "Home"
href: "index.qmd"
aria-label: "Home"After rendering the page, the menu item looks like this. <li class="nav-item">
<a class="nav-link active" href="./index.html" aria-current="page">
<span class="menu-text">Home</span></a>
</li> I was expecting actual |
Replies: 1 comment 2 replies
|
You're using it correctly, but
For a text-only item like yours, the label is simply ignored. That's fine for accessibility, because the visible Where it matters is an icon-only item, which has no visible text to name the link: website:
navbar:
right:
- icon: github
href: https://github.com/<user>/<repo>
aria-label: "GitHub"This renders |
You're using it correctly, but
aria-labelon a navigation item only applies to its icon. Quarto writes it on the<i>element of the Bootstrap icon, and only when the item also has anicon:quarto-cli/src/resources/projects/website/templates/navicon.ejs
Lines 2 to 10 in b74bec2
For a text-only item like yours, the label is simply ignored. That's fine for accessibility, because the visible
textalready gives the link its…