[a11y] - Document best practice for use of aria-current with RouterLink / RouterLinkActive
See original GitHub issueš feature request
Relevant Package
This feature request is for @angular/router
Description
RouterLinkActive
adds a class to the element, it should add the aria-current
attribute which must be set to 'Page'
when isActive
is true in the RouterLinkActive
.
Describe alternatives youāve considered
<a #fruitsLink="routerLinkActive" routerLinkActive="active" #fruitsRouterLink="routerLinkActive" [attr.aria-current]="fruitsRouterLink.isActive ? 'Page': undefined" title="fruits" routerLink="/fruits" >Fruits š</a>
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:12 (10 by maintainers)
Top Results From Across the Web
RouterLinkActive - Angular
Tracks whether the linked route of an element is currently active, and allows you to specify one or more CSS classes to add...
Read more >Make it accessible: Navigation in Angular - This Dot Labs
First, we'll need to use the routerLinkActive directive in the anchors from the navigation. For this, we need to go to the src/app/app.componentĀ ......
Read more >Photosnap multi-page website VueJS 3 / Cli - Frontend Mentor
This link points to a named anchor `/` within the document, but no anchor ... <a aria-current="page" href="#/" class="router-link-active ...
Read more >Vertical Nav - Clarity Design System - Documentation
Design Guidelines. Vertical navigation is a familiar navigation pattern for users. It can fit as many navigation links as needed, scrolling when the...
Read more >Setting Up App Navigation Inside an Angular Component File
It is a best practice to leave the presentation as clean as ... The next thing is adding the router link active option...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@jelbourn, @twerske, and I discussed this change and agreed that based on discussions above about how setting
aria-current="page"
is not the correct thing for all cases, we donāt want to bake this behavior in to theRouterLinkActive
. Iāve updated the issue to indicate that this should be addressed through a11y best practices documentation.Iām too thinking, itās better to let a developer decide when to set aria-current. E.g. for breadcrumbs usage, itās more recommended to use aria-current=ālocationā than aria-current=āpageā (https://www.aditus.io/patterns/breadcrumbs/). As another idea, we could add possibilities to configure the attribute in routerLinkActiveOptions. Also I think the label should only be set if the exact match option is set to true. Otherwise, again for example in breadcrumbs usage, you would have more than one link set with aria-current.