-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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][IconButton] disableRipple
on MuiButtonBase
doesn't disable ripple effect on IconButton
#43617
Comments
Looks like this regression is from #43271 This is how check for But this behaviour was changed here, I think we can solve this like below, but i'm not sure how efficient solution is const IconButton = React.forwardRef(function IconButton(inProps, ref) {
const props = useDefaultProps({ props: inProps, name: 'MuiIconButton' });
+ // eslint-disable-next-line material-ui/mui-name-matches-component-name
+ const buttonBaseProps = useDefaultProps({ props: inProps, name: 'MuiButtonBase' });
const {
edge = false,
children,
className,
color = 'default',
disabled = false,
disableFocusRipple = false,
- disableRipple = false,
+ disableRipple: disableRippleProp,
size = 'medium',
...other
} = props;
+ const disableRipple = disableRippleProp ?? buttonBaseProps.disableRipple ?? false; |
@sai6855 Let's revert the change in #43271 and fix the variants of IconButton to: variants: [
{
- props: { disableRipple: false },
+ props: (props) => !props.disableRipple,
style: {
'&:hover': {
backgroundColor: theme.vars
? `rgba(${theme.vars.palette.action.activeChannel} / ${theme.vars.palette.action.hoverOpacity})`
: alpha(theme.palette.action.active, theme.palette.action.hoverOpacity),
// Reset on touch devices, it doesn't add specificity
'@media (hover: none)': {
backgroundColor: 'transparent',
},
},
},
}, |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @Studio384 How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
The regression portion of this issue is solved in #43714. About the issue that is also present in v5: "Disabling ripple on MuiIconButton does not disable any hover effects, as this property does when applied to MuiButtonBase." @Studio384 may I ask you to create a separate issue for it so it's easier to track? |
Steps to reproduce
Link to live example: https://codesandbox.io/p/sandbox/friendly-sunset-w3d9ft
Steps:
MuiButtonBase
as described in the documentation.IconButton
components.MuiIconButton
.IconButton
components here too.Current behavior
IconButton
components. The prop is completely ignored, where in v5 this would disable the ripple.Expected behavior
MuiButtonBase
disables it for all button types, as v5 used to do.MuiIconButton
does not disable any hover effects, as this property does when applied toMuiButtonBase
. This issue is also present in v5.Context
No response
Your environment
No response
Search keywords: ripple icon button
The text was updated successfully, but these errors were encountered: