Skip to content

Commit

Permalink
fix: Drawer mask not lock scroll (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ authored Nov 11, 2022
1 parent 47d4eea commit 65435ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const Drawer: React.FC<DrawerProps> = props => {
prefixCls,
afterOpenChange,
destroyOnClose,
mask,
} = props;

const [animatedVisible, setAnimatedVisible] = React.useState(false);
Expand Down Expand Up @@ -57,7 +58,7 @@ const Drawer: React.FC<DrawerProps> = props => {
open={open || forceRender || animatedVisible}
autoDestroy={false}
getContainer={getContainer}
autoLock={open || animatedVisible}
autoLock={mask && (open || animatedVisible)}
>
<DrawerPopup {...sharedDrawerProps} inline={getContainer === false} />
</Portal>
Expand Down
4 changes: 3 additions & 1 deletion tests/index.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down

1 comment on commit 65435ec

@vercel
Copy link

@vercel vercel bot commented on 65435ec Nov 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

drawer – ./

drawer-react-component.vercel.app
drawer.vercel.app
drawer-git-master-react-component.vercel.app

Please sign in to comment.