Angular

angular/router-aria-current

A routerLinkActive link also sets ariaCurrentWhenActive, so the current page is announced, not only styled.

moderatestaticWCAG 1.3.1 · Afe-angular

Why

routerLinkActive only adds a class: sighted users see which navigation item is the current page, but a screen reader announces every link the same way. The relationship shown visually is missing from the markup.

Fix

Add ariaCurrentWhenActive="page" next to routerLinkActive (use "step", "location" or "true" where those fit better). Angular then sets aria-current while the link is active and removes it afterwards.

Examples

<!-- bad -->
<a routerLink="/orders" routerLinkActive="active">Orders</a>
<!-- good -->
<a routerLink="/orders" routerLinkActive="active" ariaCurrentWhenActive="page">Orders</a>

Sources

Facts

Id
angular/router-aria-current
Severity
moderate
Check
static checked in the source by audit
Applies to
angular
Only in projects with
angular
WCAG 2.2
1.3.1, level A
Taught by the skill
fe-angular Angular components
Since version
0.1.0

Rule file on GitHub

Read it in the terminal

npx github:dawidolko/frontend-skills explain angular/router-aria-current