[ButtonBase] Incorrectly adds role='button' when using a custom component and passing an href prop
See original GitHub issueWhen using a material-ui button it adds role='button'
when using a custom component prop even when passing an href prop.
I believe that this line in ButtonBase.js is the culprit. Perhaps it should be an &&
instead of ||
- 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 😯
Material-Ui ButtonBase.js applies role='button'
attribute to the button when using a custom component even when passing an href prop
Expected Behavior 🤔
when using a custom component and passing an href prop to a button it should not have role='button'
applied
Steps to Reproduce 🕹
See repro here: https://codesandbox.io/s/green-sun-vduiu?file=/src/Demo.tsx
Steps:
- inspect button and see it has
role='button'
on it
Context 🔦
Trying to create proper accessibility for links that look like buttons in a Gatsby.js site.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
[ButtonBase] Incorrectly adds role='button' when using a ...
When using a material-ui button it adds role='button' when using a custom component prop even when passing an href prop.
Read more >Material UI - The `component` prop provided to ButtonBase is ...
(3) Material-UI: The component prop provided to ButtonBase is invalid. Please make sure the children prop is rendered in this custom component.
Read more >Strict Mode - React
When strict mode is enabled, React compiles a list of all class components using the unsafe lifecycles, and logs a warning message with...
Read more >Global Styling with Material-UI Theme Overrides and Props
Learn how to use global CSS overrides and default props in a theme to customize all instances of a Material-UI component in a...
Read more >Warning: Each Child in a List Should Have a Unique 'key' Prop
It is not recommended to use the index of the array as the key prop if ... Then React will get confused and...
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
Sounds good. @Gautam-Arora24 you may start working on this if you want 😃
Let’s discuss this in a PR with a concrete implementation and test. Manually going through implementation is not viable.