question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ButtonBase] Improve Button accessibility

See original GitHub issue

Revert #10339 removed safeguard and add additional one so anchors missing href’s are treated as buttons.

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

An anchor with an href should not be assigned role=button.

Current Behavior 😯

An anchor with prop button w/ href is being given role of button as it misleads users. A button does not alter the url path while an href does.

Steps to Reproduce 🕹

<ListItem component={Link} to={path} button>
Hi there
</ListItem>

Context 🔦

Screen reader

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
bluSCALE4commented, Apr 30, 2019

Well then, thank you both for the feedback. I’ll try to get this in before the end of the week.

On Mon, Apr 29, 2019, 4:13 PM Olivier Tassinari notifications@github.com wrote:

@bluSCALE4 https://github.com/bluSCALE4 Do you want to submit a pull request? 😃

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mui-org/material-ui/issues/15512#issuecomment-487745771, or mute the thread https://github.com/notifications/unsubscribe-auth/AABQ526PY5JKX3CMXZZKM33PS5QGNANCNFSM4HI5Y2SQ .

0reactions
ryancogswellcommented, May 8, 2019

@bluSCALE4 Any role explicitly specified by the user (including null or link) will win without any additional logic. A role specified by the user will be part of ...other and ...other will win over ...buttonProps where any overlap occurs due to the order that they are spread onto the component:

        {...buttonProps}
        {...other}
      >

Here is a modification of the Third-party routing library demo showing this: https://codesandbox.io/s/xo31norvxq

Read more comments on GitHub >

github_iconTop Results From Across the Web

[ButtonBase] Improve Button accessibility #15512 - GitHub
An anchor with prop button w/ href is being given role of button as it misleads users. A button does not alter the...
Read more >
Building Accessible Buttons with ARIA: A11y Support Series
Continuing on with our series, we're going to build another accessible ARIA widget: a simple role=”button” UI control. Then we'll test what ...
Read more >
ButtonBase API - Material UI - MUI
Name Type Default action ref centerRipple bool false children node
Read more >
Pass Accessibility Props to Material UI Button - Stack Overflow
How do I pass the additional props (accessKey, ariaLabel) into the Material UI Button. How do I do this? reactjs · button ·...
Read more >
ARIA: button role - Accessibility - MDN Web Docs
The button role identifies an element as a button to assistive technology such as screen readers. A button is a widget used to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found