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.

[docs] missing role="link" for Button with Link

See original GitHub issue

Using the documented way of creating links styled as buttons as seen in https://next.material-ui.com/guides/routing/#button adds wrong role on the rendered element. Specifically it adds role="button" making the link undiscoverable from google crawlers. I would at least hope that it was documented that I have to manually type role="link" to make links discoverable.

  • 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 😯

Using <Button component={RouterLink} to="/"> I get an <a href="/" role="button"> rendered. The assigned accessibility role is “button”

Expected Behavior 🤔

Using <Button component={RouterLink} to="/"> I expect to have an accessibility role of “link”

Steps to Reproduce 🕹

Steps:

  1. Go to https://next.material-ui.com/guides/routing/#button
  2. Inspect the rendered <a> and observe an incorrect role attribute

Your Environment 🌎

v5.0.0-alpha.34 react-router-dom v6 beta.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, May 30, 2021

@shadab14meb346 All good from my end 👍

1reaction
oliviertassinaricommented, May 26, 2021

@shadab14meb346 For the change in the documentation, I think that it’s a good initiative, but we likely want to keep it straight:

> **Note**:  When the `component` prop is used on the `ButtonBase` and not indicators are
given that a link is rendered, a `role="button"` prop is provided by the `ButtonBase` to the component. 
You need to swallow this attribute if you are rendering a link, e.g. with `role={undefined}`.

and no change in documentation should be necessary

@itsUndefined I think that we have to change the documentation, as our least worse option. We can’t know if the component is used to render a button or a link. Not adding a role button would be even worse for when developers render a div.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[docs] missing role="link" for Button with Link · Issue #26453
Specifically it adds role="button" making the link undiscoverable from google crawlers. I would at least hope that it was documented that I have ......
Read more >
Google form only showing a Get Link button
When I test the form by clicking on its link in a web page, it only shows the Get Link button. I've filled...
Read more >
Documentation – Circuit Happy, LLC
Press the Play button on The Missing Link to start the clock. For Syncing with MIDI Devices. The Missing Link supports sending MIDI...
Read more >
SharePoint Online button webpart with link to document not ...
Hi,. We have different pages that contain a default "button webpart" which has a link to a document in a library on SharePoint...
Read more >
"+ Add Document" link missing for some users
@BennySkogberg: When I give Contribute permissions to the user on the designated folder, the "Add Documents" link is still not showing. Is there ......
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