feat(core): add aria-current to active links (close #2116) - #3073
Conversation
|
hey @smhigley thanks for the well detailed PR! I think this makes sense and is safe to add as a default for vue router but I was wondering about point 2: applying it to active instead of exact-active. I think the latter makes more sense as a default because it is more likely to end up in one single element marked as It's not directly related but I also wanted to note that active and exact behavior is very likely to change on v4 (vuejs/rfcs#136) and I was going to use exact active to set it. If you have any input for that, please go ahead 馃檪 ! |
|
@posva I updated the PR to add I originally did non-exact active because the tutorials and examples I happened to see seemed to be adding active styles based on the active class, and I was trying to choose whichever would add most parity between visual active styles and |
|
Thank you! 馃槃 |
Hi! First contributor + pretty new to Vue 馃憢 馃槃
This PR adds
aria-current="page"to active links, and resolves #2116. I made the following two choices:Use
aria-current="page"over other token valuesThe original issue mentions allowing custom token values, or future
<router-link>extension possibilities. That still seems useful, butaria-current="page"seems like the right choice at least 90% of the time. The other tokens are either much less common (e.g.step) or unlikely to be used with a router at all (e.g.date)Use the
activeClasslogic over only applying it to the exact active routeThis is more hand-wavy, but seems like the better choice -- URL params shouldn't necessarily affect
aria-current, and it's not the worst thing to have parent routes also receivearia-currentifexactis not applied.I'm hoping this is a small enough change that it can go in before the harder work of figuring out how to extend
<router-link>is done, and it seems like a sensible default even with customization. I've run into some issues using vue-router b/c of this, so I'd personally love to seearia-currentadded :). I'm happy to answer any questions on the accessibility side, and let me know if I missed anything PR-wise. Thanks!