diff --git a/components/ui/Sidebar/Sidebar.tsx b/components/ui/Sidebar/Sidebar.tsx index a0d5e8339..96f41cd4c 100644 --- a/components/ui/Sidebar/Sidebar.tsx +++ b/components/ui/Sidebar/Sidebar.tsx @@ -1,11 +1,6 @@ import s from './Sidebar.module.css' import Portal from '@reach/portal' -import { FC, useEffect, useRef } from 'react' -import { - disableBodyScroll, - enableBodyScroll, - clearAllBodyScrollLocks, -} from 'body-scroll-lock' +import { FC, useEffect } from 'react' interface Props { children: any @@ -14,25 +9,19 @@ interface Props { } const Sidebar: FC = ({ children, open = false, onClose }) => { - const ref = useRef() as React.MutableRefObject useEffect(() => { - if (ref.current) { - if (open) { - disableBodyScroll(ref.current) - } else { - enableBodyScroll(ref.current) - } - } - return () => { - clearAllBodyScrollLocks() + if (open) { + document.body.style.overflow = 'hidden' + } else { + document.body.style.overflow = 'auto' } }, [open]) return ( {open ? ( -
+