nuxt / ui

A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
https://ui.nuxt.com
MIT License
3.53k stars 409 forks source link

Breadcrumb aria-current value #1856

Open itsacoyote opened 2 weeks ago

itsacoyote commented 2 weeks ago

Environment

Version

2.16.0

Reproduction

https://ui.nuxt.com/pro/getting-started/theming

Description

This is primarily for the usage with @nuxt/content. The breadcrumbs component checks simply against index and sets a aria-current to page for the last item in the array of links. This does not check to see whether the last item's linkk is the current page's URL.

For example in the Pro docs, the breadcrumbs for the URL listed above, /pro/getting-started/theming, it displays the breadcrumbs Pro > Getting Started and the page header is Theming. In the breadcrumbs, "Getting Started" is defined as aria-current="page". Semantically I don't think this is correct.

I have a similar structure of breadcrumbs on my website and I tried to set ariaCurrentValue to "false" to try and disable setting the aria-current to page for the last breadcrumb. It is displayed as a prop available on links for the Breadcrumb component. But it does not look like it does anything. Is this not a configurable property or a bug?

Additional context

No response

Logs

No response

benjamincanac commented 2 weeks ago

You're totally right, the aria-current="page" should only apply when the link is active. However, we don't have an easy way to fix that at the moment as it would require a big refactor of the ULink component. I'll flag this for v3 as I fixed it already there.

For now, I moved the aria-current before the v-bind so you can override it per link: https://github.com/nuxt/ui/commit/ebfb8350339725c0a6f88c73f16bff01d61538c2.