diff --git a/src/Drawer.tsx b/src/Drawer.tsx index f7dd6a7f..e6761588 100644 --- a/src/Drawer.tsx +++ b/src/Drawer.tsx @@ -25,6 +25,7 @@ const Drawer: React.FC = props => { prefixCls, afterOpenChange, destroyOnClose, + mask, } = props; const [animatedVisible, setAnimatedVisible] = React.useState(false); @@ -57,7 +58,7 @@ const Drawer: React.FC = props => { open={open || forceRender || animatedVisible} autoDestroy={false} getContainer={getContainer} - autoLock={open || animatedVisible} + autoLock={mask && (open || animatedVisible)} > diff --git a/tests/index.spec.tsx b/tests/index.spec.tsx index b8d20d90..6a901def 100755 --- a/tests/index.spec.tsx +++ b/tests/index.spec.tsx @@ -131,7 +131,9 @@ describe('rc-drawer-menu', () => { const drawer = document.querySelector('.rc-drawer'); expect(drawer).toBeTruthy(); expect(document.body.contains(drawer)).toBeTruthy(); - expect(document.body.style.overflow).toBe(''); + expect(document.body).not.toHaveStyle({ + overflowY: 'hidden', + }); unmount(); });