Skip to content

Commit 16d9960

Browse files
committed
fix: scrollLocker lock trigger should disabled when no mask
1 parent 5b659ce commit 16d9960

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/DrawerChild.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
9393
} catch (err) {}
9494
this.passive = passiveSupported ? { passive: false } : false;
9595
}
96-
const { open, getContainer } = this.props;
96+
const { open, getContainer, showMask } = this.props;
9797
const container = getContainer && getContainer();
9898
this.drawerId = `drawer_id_${Number(
9999
(Date.now() + Math.random())
@@ -110,12 +110,14 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
110110
this.forceUpdate(() => {
111111
this.domFocus();
112112
});
113-
this.props.scrollLocker?.lock();
113+
if (showMask) {
114+
this.props.scrollLocker?.lock();
115+
}
114116
}
115117
}
116118

117119
public componentDidUpdate(prevProps: IDrawerChildProps) {
118-
const { open, getContainer, scrollLocker } = this.props;
120+
const { open, getContainer, scrollLocker, showMask } = this.props;
119121
const container = getContainer && getContainer();
120122
if (open !== prevProps.open) {
121123
if (container && container.parentNode === document.body) {
@@ -124,7 +126,9 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
124126
this.openLevelTransition();
125127
if (open) {
126128
this.domFocus();
127-
scrollLocker?.lock();
129+
if (showMask) {
130+
scrollLocker?.lock();
131+
}
128132
} else {
129133
scrollLocker?.unLock();
130134
}

0 commit comments

Comments
 (0)