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

MuiTouchRipple style overrides aren't applying #30501

Open
2 tasks done
meds opened this issue Jan 5, 2022 · 8 comments
Open
2 tasks done

MuiTouchRipple style overrides aren't applying #30501

meds opened this issue Jan 5, 2022 · 8 comments
Labels
status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it support: question Community support but can be turned into an improvement

Comments

@meds
Copy link

meds commented Jan 5, 2022

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

With the following defined inside theme:
`{
components: {

MuiTouchRipple: {
    styleOverrides: {
        childLeaving: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        },
        ripple: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        },
        ripplePulsate: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        },
        root: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        },
        rippleVisible: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        },
        child: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        },
        childPulsate: {
            backgroundColor: '#ff9900',
            color: '#00ff00'
        }
    }
}

}`

I'm not seeing the ripple colour on buttons change and I odn't see where the colors specifieid above apply to Muitouchripple on any level

Expected behavior 🤔

Colours defined in MuiTouchRipple override should apply to buttons.

Steps to reproduce 🕹

Steps:

  1. Use style override as provided
  2. Attempt to add a button and ckick it

or

View sandbox: https://codesandbox.io/s/material-ui-v5-theme-sandbox-forked-u228v?file=/src/Demo.tsx:0-1773

Context 🔦

No response

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@meds meds added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 5, 2022
@siriwatknp
Copy link
Member

TouchRipple is considered an internal component in v5. Can you share the use case where theming TouchRipple makes sense?

@siriwatknp siriwatknp added support: question Community support but can be turned into an improvement status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 6, 2022
@meds
Copy link
Author

meds commented Jan 6, 2022

TouchRipple is considered an internal component in v5. Can you share the use case where theming TouchRipple makes sense?

I'm themeing an app and want to use a custom ripple colour over components on mouse down.

@siriwatknp
Copy link
Member

I suggest you use &:active + color on the Button. The TouchRipple's background-color inherits color from the Button.
Check this out: https://codesandbox.io/s/material-ui-v5-theme-sandbox-forked-uk0ns?file=/src/Demo.tsx

@danilo-leal
Copy link
Contributor

@meds Could we close the issue? Has your problem been solved?

@eGene
Copy link

eGene commented Mar 7, 2022

Maybe not the best place to ask this, but I was thinking to override ripple's colors to fix a11y contrast issues. Current mechanics of inheriting color and applying transparency makes many elements fail WCAG contrast requirements on focus. What is the official MUI's team position on this issue (couldn't find it anywhere)?

@hutber
Copy link

hutber commented Mar 7, 2022

I've been struggling with this for a few hours.
It would be great to get some examples of how this would work. The issue is, I am unable to insect the ripple to know what the class names are to override them too. @siriwatknp thanks for the sandbox, however its working.

@danilo-leal
Copy link
Contributor

@eGene I guess it would be great to talk about this matter in a different issue! Do you want to open it?

@eGene
Copy link

eGene commented Mar 8, 2022

Created #31372.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

5 participants