From b53c1ad6b6421aa28953fc916679a37244d964c3 Mon Sep 17 00:00:00 2001 From: Zack Mayoh Date: Thu, 2 Dec 2021 16:48:32 -0600 Subject: [PATCH] [Drawer] Allow clicks under closed persistent Drawer Stops right-anchored persistent drawers from intercepting the mouse when they are closed. --- packages/mui-material/src/Drawer/Drawer.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/mui-material/src/Drawer/Drawer.js b/packages/mui-material/src/Drawer/Drawer.js index b1b3bc97f269dc..e515eb97a0b9a8 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.zIndex.drawer, + ...(!ownerState.open && { + zIndex: -1, + }), })); const DrawerDockedRoot = styled('div', { @@ -54,9 +57,12 @@ const DrawerDockedRoot = styled('div', { slot: 'Docked', skipVariantsResolver: false, overridesResolver, -})({ +})(({ ownerState }) => ({ flex: '0 0 auto', -}); + ...(!ownerState.open && { + zIndex: -1, + }), +})); const DrawerPaper = styled(Paper, { name: 'MuiDrawer',