Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessibility: Links should be links (and be focusable) #102

Open
marcysutton opened this issue Jan 24, 2018 · 1 comment
Open

Accessibility: Links should be links (and be focusable) #102

marcysutton opened this issue Jan 24, 2018 · 1 comment

Comments

@marcysutton
Copy link

This HTML is problematic for keyboard and screen reader users:

<a role="button" *ngIf="!last && url == prefix" (click)="navigateTo('/')">{{url}}</a>
<a role="button" *ngIf="!last && url != prefix" (click)="navigateTo(url)">{{friendlyName(url)}}</a>

The role="button" here isn't enough to make these accessible in the absence of href attributes; that just changes the role of the link to a button in a screen reader (and doesn't impact focusability). Is there a reason why you can't use href="/" / href={url} and actual client-side routing instead of (click)? That way you could leverage the anchor tag's default capabilities, including focusability.

In any case, without href you at least need tabindex="0" to make these items focusable to keyboard and screen reader users. I'd also recommend removing the role="button" since these are navigating the user someplace.

For more information on links vs. buttons, I wrote a blog post: https://marcysutton.com/links-vs-buttons-in-modern-web-applications/

@cmegown
Copy link

cmegown commented Jan 24, 2018

This should be a pretty quick fix to implement. Additional information can be found here: https://www.w3.org/TR/wai-aria-practices/#breadcrumb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants