diff --git a/packages/mui-material/src/Button/Button.js b/packages/mui-material/src/Button/Button.js index ca4c195a80352f..570bc4a45413a8 100644 --- a/packages/mui-material/src/Button/Button.js +++ b/packages/mui-material/src/Button/Button.js @@ -318,7 +318,7 @@ const Button = React.forwardRef(function Button(inProps, ref) { const fullWidth = fullWidthProp || fullWidthContext || false; const size = sizeProp || sizeContext || 'medium'; const variant = variantProp || variantContext || 'text'; - const disableRipple = disableRippleProp || disableRippleContext || false; + const disableRipple = disableRippleContext || disableRippleProp; const ownerState = { ...props, diff --git a/packages/mui-material/src/Button/Button.test.js b/packages/mui-material/src/Button/Button.test.js index cfc5344335858a..6d3da3975d2047 100644 --- a/packages/mui-material/src/Button/Button.test.js +++ b/packages/mui-material/src/Button/Button.test.js @@ -1,8 +1,9 @@ import * as React from 'react'; import { expect } from 'chai'; import { describeConformance, act, createRenderer, fireEvent } from 'test/utils'; +import { ThemeProvider, createTheme } from '@mui/material/styles'; import Button, { buttonClasses as classes } from '@mui/material/Button'; -import ButtonBase from '@mui/material/ButtonBase'; +import ButtonBase, { touchRippleClasses } from '@mui/material/ButtonBase'; describe(' + , + ); + expect(container.firstChild.querySelector(`.${touchRippleClasses.root}`)).to.equal(null); + }); + + it("should disable ripple when MuiButtonBase has disableRipple in theme's defaultProps but override on the individual Buttons if provided", () => { + const theme = createTheme({ + components: { + MuiButtonBase: { + defaultProps: { + disableRipple: true, + }, + }, + }, + }); + const { container } = render( + + + + + , + ); + expect(container.querySelectorAll(`.${touchRippleClasses.root}`)).to.have.length(1); + }); });