You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
This HTML is problematic for keyboard and screen reader users:
The
role="button"
here isn't enough to make these accessible in the absence ofhref
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 usehref="/"
/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 needtabindex="0"
to make these items focusable to keyboard and screen reader users. I'd also recommend removing therole="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/
The text was updated successfully, but these errors were encountered: