dojo/framework

ActiveLink: add support for aria-current attribute

msssk opened this issue · 0 comments

msssk commented

Enhancement

ActiveLink would benefit from adding support for the aria-current attribute. This could be achieved by adding an ariaCurrent property and setting it when the link is active.

export interface ActiveLinkProperties extends LinkProperties {
	activeClasses: SupportedClassName[];
	ariaCurrent?: 'page' | 'step' | 'location' | 'date' | 'time' | true;
	isExact?: boolean;
}

Code

<ActiveLink
    to="myRoute"
    classes="link"
    activeClasses="active"
    ariaCurrent="page"
>
    Link to my route
</ActiveLink>

Expected behavior:

<a href="myroute" class="link active" aria-current="page">Link to my route</a>