Button should add role="button" when href prop is set (link button)
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
The following jsx results in an <a>
tag that does not have role="button"
<Button href={url} target="_blank"> click here </Button>
Expected Behavior 🤔
The link button should have role="button"
for accessability
Steps to Reproduce 🕹
Tech | Version |
---|---|
Material-UI | v4.10.1 |
React | 16.13.1 |
Browser | all |
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Button should add role="button" when href prop is set (link ...
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >ARIA: button role - Accessibility - MDN Web Docs
The button role is for clickable elements that trigger a response when activated by the user. Adding role="button" tells the screen reader ...
Read more >Wrapping a react-router Link in an html button - Stack Overflow
I was wondering if there is a way to wrap a Link element from 'react-router' in an HTML button tag using react. I...
Read more >Accessible links and buttons with React - Kitty Giraudel
This implies that a lot of links should become buttons when JavaScript is enabled and running. To avoid authoring ternaries all over the...
Read more >How to Use a Button as a Link in React - Coding Beauty
Use Material UI button as link When using Material UI, we can specify a link for the Button component using the href prop....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why? What you’re claiming is that
<a href="example.com" target="_blank" />
is a button not a hyperlink. It triggers navigation therefore it’s an hyperlink.Could you explain your rationale?
Why did they pass an
href
then? This seems like an exotic use case that we can’t audit completely.It would also be a breaking change. I’m closing this issue until more information is provided. In the meantime:
<Button href="example.com" target="_blank" role="button" />
is still possible.