Skip to content

Commit 65435ec

Browse files
authored
fix: Drawer mask not lock scroll (#350)
1 parent 47d4eea commit 65435ec

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Drawer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const Drawer: React.FC<DrawerProps> = props => {
2525
prefixCls,
2626
afterOpenChange,
2727
destroyOnClose,
28+
mask,
2829
} = props;
2930

3031
const [animatedVisible, setAnimatedVisible] = React.useState(false);
@@ -57,7 +58,7 @@ const Drawer: React.FC<DrawerProps> = props => {
5758
open={open || forceRender || animatedVisible}
5859
autoDestroy={false}
5960
getContainer={getContainer}
60-
autoLock={open || animatedVisible}
61+
autoLock={mask && (open || animatedVisible)}
6162
>
6263
<DrawerPopup {...sharedDrawerProps} inline={getContainer === false} />
6364
</Portal>

tests/index.spec.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ describe('rc-drawer-menu', () => {
131131
const drawer = document.querySelector('.rc-drawer');
132132
expect(drawer).toBeTruthy();
133133
expect(document.body.contains(drawer)).toBeTruthy();
134-
expect(document.body.style.overflow).toBe('');
134+
expect(document.body).not.toHaveStyle({
135+
overflowY: 'hidden',
136+
});
135137
unmount();
136138
});
137139

0 commit comments

Comments
 (0)