question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[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:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
atscottcommented, Jun 16, 2021

@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 the RouterLinkActive. I’ve updated the issue to indicate that this should be addressed through a11y best practices documentation.

1reaction
jeripeierSBBcommented, Apr 23, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found