diff --git a/packages/mui-material/src/Drawer/Drawer.js b/packages/mui-material/src/Drawer/Drawer.js index 3b9491de5c4753..5eab914c84c5ab 100644 --- a/packages/mui-material/src/Drawer/Drawer.js +++ b/packages/mui-material/src/Drawer/Drawer.js @@ -44,8 +44,11 @@ const DrawerRoot = styled(Modal, { name: 'MuiDrawer', slot: 'Root', overridesResolver, -})(({ theme }) => ({ +})(({ theme, ownerState }) => ({ zIndex: (theme.vars || theme).zIndex.drawer, + ...(!ownerState.open && { + visibility: 'hidden', + }), })); const DrawerDockedRoot = styled('div', { @@ -54,9 +57,12 @@ const DrawerDockedRoot = styled('div', { slot: 'Docked', skipVariantsResolver: false, overridesResolver, -})({ +})(({ ownerState }) => ({ flex: '0 0 auto', -}); + ...(!ownerState.open && { + visibility: 'hidden', + }), +})); const DrawerPaper = styled(Paper, { name: 'MuiDrawer',