Skip to content

Commit

Permalink
fix to backdrop.js and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Harry Whorlow committed Feb 16, 2024
1 parent 23a06da commit 3d2840b
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions packages/mui-material/src/Backdrop/Backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ const Backdrop = React.forwardRef(function Backdrop(inProps, ref) {
children,
className,
component = 'div',
components = {},
componentsProps = {},
invisible = false,
open,
slotProps = {},
Expand All @@ -68,34 +66,33 @@ const Backdrop = React.forwardRef(function Backdrop(inProps, ref) {

const classes = useUtilityClasses(ownerState);

const rootSlotProps = slotProps.root ?? componentsProps.root;

const backwardCompatibleSlots = { transition: TransitionComponentProp, ...slots };

const externalForwardedProps = {
slots: backwardCompatibleSlots,
slotProps,
};

const [RootSlot, rootProps] = useSlot('root', {
elementType: BackdropRoot,
externalForwardedProps,
className: clsx(classes.root, className),
ownerState,
});

const [TransitionSlot, transitionProps] = useSlot('transition', {
elementType: Fade,
externalForwardedProps: {
slots: backwardCompatibleSlots,
slotProps,
},
externalForwardedProps,
ownerState,
});

delete transitionProps.ownerState;

return (
<TransitionSlot in={open} timeout={transitionDuration} {...other} {...transitionProps}>
<BackdropRoot
aria-hidden
{...rootSlotProps}
as={slots.root ?? components.Root ?? component}
className={clsx(classes.root, className, rootSlotProps?.className)}
ownerState={{ ...ownerState, ...rootSlotProps?.ownerState }}
classes={classes}
ref={ref}
>
<RootSlot aria-hidden {...rootProps} classes={classes} ref={ref}>
{children}
</BackdropRoot>
</RootSlot>
</TransitionSlot>
);
});
Expand Down

0 comments on commit 3d2840b

Please sign in to comment.