diff --git a/packages/mui-material/src/Modal/Modal.js b/packages/mui-material/src/Modal/Modal.js index c25792fda36a02..173a74a68ce71b 100644 --- a/packages/mui-material/src/Modal/Modal.js +++ b/packages/mui-material/src/Modal/Modal.js @@ -154,7 +154,10 @@ const Modal = React.forwardRef(function Modal(inProps, ref) { elementType: RootSlot, externalSlotProps: rootSlotProps, externalForwardedProps: other, - getSlotProps: getRootProps, + getSlotProps: (otherHandlers) => { + const { onTransitionEnter, onTransitionExited, ...restOfHandlers } = otherHandlers; + return getRootProps(restOfHandlers); + }, additionalProps: { ref, as: component, diff --git a/packages/mui-material/src/Modal/Modal.test.js b/packages/mui-material/src/Modal/Modal.test.js index efea82a0e1f8bf..5930f05ffa9202 100644 --- a/packages/mui-material/src/Modal/Modal.test.js +++ b/packages/mui-material/src/Modal/Modal.test.js @@ -871,4 +871,14 @@ describe('', () => { expect(getByTestId('backdrop')).to.have.class('custom-backdrop'); }); }); + + it.only('should not warn when onTransitionEnter and onTransitionExited are provided', () => { + expect(() => { + render( + {}} onTransitionExited={() => {}}> +
+ , + ); + }).not.toErrorDev(); + }); });