Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[material-ui][Button] Provide an accessible focus alternative when disableRipple prop is set #35843

Open
dimitur2204 opened this issue Jan 16, 2023 · 4 comments
Assignees
Labels
accessibility a11y component: button This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material

Comments

@dimitur2204
Copy link

What's the problem? 🤔

When you use the disableRipple: true, property on the theme.components as such

    MuiButtonBase: {
      defaultProps: {
        disableRipple: true,
      },
    },

Then all of the components that rely on the Mui-focusVisible class for ripple styling become unaccessible. When you focus them with keyboard nothing happens, you can't tell they are focused.

Ripple Disabled Ripple
ripple no-ripple

What are the requirements? ❓

There needs to be some kind of fallback on that. I did that in my app and was left scratching my head for a while, why nothing is working, including:

  • Radio Buttons
  • Checkboxes
  • Buttons

What are our options? 💡

What I have done in my app is a global style to the:

.Mui-focusVisible: {
outline: 2px solid #000
}

There should be some fallback

Proposed solution 🟢

I am unaware of the internals of MUI and someone with more knowledge should propose a solution. My solution to my application is what I wrote in the "What are our options? 💡" section.

Resources and benchmarks 🔗

No response

@dimitur2204 dimitur2204 added the RFC Request For Comments label Jan 16, 2023
@dimitur2204 dimitur2204 changed the title [RFC] Provide an accessible :focus alternative when disableRipple property on the MuiButtonBase is on! [RFC] Provide an accessible focus alternative when disableRipple property on the MuiButtonBase is on! Jan 16, 2023
@kachar
Copy link

kachar commented Jan 16, 2023

@dimitur2204 Sorry for the dull question but why do we want to disable the standard ripple effect instead of customizing it to our needs for example?

Here's a simple example https://codesandbox.io/s/mui-change-global-ripple-color-forked-zk0xr3

@dimitur2204
Copy link
Author

@dimitur2204 Sorry for the dull question but why do we want to disable the standard ripple effect instead of customizing it to our needs for example?

Here's a simple example https://codesandbox.io/s/mui-change-global-ripple-color-forked-zk0xr3

@kachar The ripple controls both the click ripple and the focus ripple. It's a common case to not want the click ripple, but by doing that you render everything that uses the focus ripple inaccessible

@oliviertassinari oliviertassinari added component: button This is the name of the generic UI component, not the React module! status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed RFC Request For Comments labels Jan 17, 2023
@dimitur2204
Copy link
Author

@michaldudak It seems like it is stated in the API for the Button Base https://mui.com/material-ui/api/button-base/#props.

@michaldudak
Copy link
Member

As you noticed, it is an expected and documented behavior. If you disable the ripple, you have to provide your own styles for the focus state.
We can't really do much to this in v5, as it may break users who depend on this, but we are going to change this in v6 (by replacing the focus ripple with a different background shade).

@michaldudak michaldudak added accessibility a11y and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 19, 2023
@michaldudak michaldudak added this to the v6 milestone Jan 19, 2023
@michaldudak michaldudak changed the title [RFC] Provide an accessible focus alternative when disableRipple property on the MuiButtonBase is on! [Button] Provide an accessible focus alternative when disableRipple property is set Jan 19, 2023
@danilo-leal danilo-leal added the package: material-ui Specific to @mui/material label Dec 1, 2023
@danilo-leal danilo-leal changed the title [Button] Provide an accessible focus alternative when disableRipple property is set [material-ui][Button] Provide an accessible focus alternative when disableRipple prop is set Dec 1, 2023
@danilo-leal danilo-leal moved this to Backlog in Material UI Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y component: button This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material
Projects
Status: Backlog
Development

No branches or pull requests

6 participants