mui / mui/material-ui

[button] Unnecessary to always have `tabindex=0`

Open
#29,169 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

scope: button type: expected behavior
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

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

Following code
<Button variant="contained">Contained</Button>
renders
image

Expected Behavior 🤔

If tabIndex is not provided to component Button, it is unnecessary to render tabindex=0 in result html since button is tab-able by default, unless a number is provided to Button as parameter.

Steps to Reproduce 🕹

Steps:

  1. go to https://mui.com/components/buttons/
  2. inspect button from one of example

Context 🔦

Accessibility

Your Environment 🌎

Chrome browser

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Button component used by the examples at https://mui.com/components/buttons/ and inspect the rendered HTML for a button without an explicit tabIndex. Check the existing Button tests or accessibility coverage, then verify that tabindex="0" is omitted when tabIndex is absent but preserved when a numeric value is provided.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.