-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend <router-link> to set an aria-current attribute for active links, instead of an active class #2116
Comments
I need a bit more help to know what is the right approach here. Is it just setting |
That's pretty much it, yes. The only nuance here is that there's more choices than just Hence the ability to configure the value of the attribute is needed. |
Hello there! I just happened to have the same issue as I wanted to manage the Any update on this improvement? I'm glad to help and do a PR if you want. The first step would be to have the possibility to add the Happy to discuss the matter and give a hand 😃 |
This is something we have in mind for the next iteration actually, to make it easier to extend router-link :) |
Thats great news! Now I can't wait for the next version :P My obvious question, and sorry for asking this: do you have an idea of the time frame for the next iteration? Thanks for the reply |
Unfortunately not. I don't even know how much time I will have to work on it 😅 |
Haha Take care and thanks for all the work done so far! |
For what its worth, here is one possible solution to work/hack with https://github.com/accessible-app/vuejs/blob/master/src/App.vue#L75 |
* feat(core): add aria-current to active links (close #2116) * feat(core): update aria-current to exact active route * feat(core): add ariaCurrentValue prop and add test * feat(core): type modification * feat(core): update aria-current typing to string
This is interfering with my ability to manually set |
Use the v slot api to have full control over all the attributes and events |
It would be nice if there were some router instance properties to customise this behaviour, sort of like we can do with the active classes. For example in a current app I am building I want a certain aria-current value for exact matches, and a different aria-current value for non exact matches |
What problem does this feature solve?
This feature enables developers to mark up the active router link in an accessible manner for users of assistive technologies.
What does the proposed API look like?
Similar to the
active-class
property on<router-link>
introduce anaria-current
string property, defaulting to anull
value. When set, use thearia-current
DOM attribute in addition to the active class.Criteria for whether the DOM attribute should be set are the same as for
active-class
. The attribute should be set on the DOM node itself -- or instead on the special nested<a>
element that router-link can upgrade, should one exist.The DOM attribute's value should be taken from the
aria-current
router-link property. Optionally, this could be validated against the list of valid options as per the ARIA 1.1 specification and console warnings could be provided on attempts to set invalid values.The text was updated successfully, but these errors were encountered: