Skip to content

Commit 88ec9f4

Browse files
committed
fix(INTERNAL-2566): drawer dance fix
1 parent b27b95b commit 88ec9f4

2 files changed

Lines changed: 1 addition & 28 deletions

File tree

src/harmony/Drawer/Drawer.module.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
margin: 0 -20px;
6262
padding: 0 20px 20px;
6363
overflow: auto;
64+
overscroll-behavior: contain;
6465
}
6566

6667
.DrawerBodyContent::-webkit-scrollbar {

src/harmony/Drawer/Drawer.tsx

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,6 @@ interface DrawerProps {
1616
onClose?: () => void;
1717
}
1818

19-
const useFocusedState = (visible?: boolean) => {
20-
const [focused, setFocused] = useState(false);
21-
const onMouseEnter = useCallback(() => {
22-
setFocused(true);
23-
}, []);
24-
25-
const onMouseLeave = useCallback(() => {
26-
setFocused(false);
27-
}, []);
28-
29-
useEffect(() => {
30-
if (visible) {
31-
document.body.style.overflow = focused ? 'hidden' : 'unset';
32-
}
33-
34-
return () => {
35-
document.body.style.overflow = 'unset';
36-
};
37-
}, [visible, focused]);
38-
39-
return {
40-
onMouseEnter,
41-
onMouseLeave,
42-
};
43-
};
44-
4519
const DrawerContext = React.createContext<Partial<{ onClose(): void }>>({
4620
onClose: () => {
4721
throw new Error('Not implemented');
@@ -68,7 +42,6 @@ export const Drawer: React.FC<React.PropsWithChildren<DrawerProps>> = ({
6842
const [onESC] = useKeyboard([KeyCode.Escape], () => onClose?.(), {
6943
disableGlobalEvent: false,
7044
});
71-
const onFocusState = useFocusedState(visible);
7245

7346
const performState = useCallback((condition: boolean, classes: [string, string]) => {
7447
if (drawerRef.current == null) {
@@ -116,7 +89,6 @@ export const Drawer: React.FC<React.PropsWithChildren<DrawerProps>> = ({
11689
})}
11790
ref={drawerRef}
11891
{...onESC}
119-
{...onFocusState}
12092
>
12193
<DrawerContext.Provider value={{ onClose }}>
12294
<DrawerBody className={s.DrawerWrapper}>{children}</DrawerBody>

0 commit comments

Comments
 (0)