Angular

angular/router-aria-current

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

umiarkowanastatyczneWCAG 1.3.1 · Afe-angular

Dlaczego

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.

Poprawka

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.

Przykłady

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

Źródła

Fakty

Identyfikator
angular/router-aria-current
Waga
umiarkowana
Sprawdzanie
statyczne sprawdzane w kodzie źródłowym przez audit
Dotyczy plików
angular
Tylko w projektach z
angular
WCAG 2.2
1.3.1, poziom A
Uczy jej skill
fe-angular Angular components
Od wersji
0.1.0

Plik reguły na GitHubie

Przeczytaj w terminalu

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