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

Don't use role=button in anchor tags if it's supposed to be a link #131

Open
SaptakS opened this issue Jan 20, 2023 · 0 comments
Open

Don't use role=button in anchor tags if it's supposed to be a link #131

SaptakS opened this issue Jan 20, 2023 · 0 comments

Comments

@SaptakS
Copy link
Contributor

SaptakS commented Jan 20, 2023

role=button should be avoided as much as possible and instead the <button> tag should be used. It doesn't matter if a link aesthetically looks like a button. What really decides whether an interactive element is a button or a link is this:

  • Does clicking on it take you to a different page, or a different view, or a different section of the same page? It's a Link
  • Does clicking on it open a modal, switch a tab panel, toggle some item, open navigation in smaller screen? Basically it stays in the same page and doesn't go somewhere else. It's a Button

For example in the home page, all the "Learn More" links are given a role=button which is wrong since it goes to a separate page. So it's a link. We should remove all such role=button because it acts just like a <button> tag for assistive technology and confusing for users.

Refs: https://www.youtube.com/watch?v=8XjwDq9zG4I

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

No branches or pull requests

1 participant