diff --git a/components/ui/Modal/Modal.tsx b/components/ui/Modal/Modal.tsx index de45c2814..40ed3b3ff 100644 --- a/components/ui/Modal/Modal.tsx +++ b/components/ui/Modal/Modal.tsx @@ -2,11 +2,8 @@ import { FC, useRef, useEffect, useCallback } from 'react' import s from './Modal.module.css' import FocusTrap from '@lib/focus-trap' import { Cross } from '@components/icons' -import { - disableBodyScroll, - clearAllBodyScrollLocks, - enableBodyScroll, -} from 'body-scroll-lock' +import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock' + interface ModalProps { className?: string children?: any @@ -34,9 +31,6 @@ const Modal: FC = ({ children, onClose }) => { window.addEventListener('keydown', handleKey) } return () => { - if (modal) { - enableBodyScroll(modal) - } clearAllBodyScrollLocks() window.removeEventListener('keydown', handleKey) } diff --git a/components/ui/Sidebar/Sidebar.tsx b/components/ui/Sidebar/Sidebar.tsx index 8883eb7c9..688d9aa58 100644 --- a/components/ui/Sidebar/Sidebar.tsx +++ b/components/ui/Sidebar/Sidebar.tsx @@ -1,11 +1,7 @@ import { FC, useEffect, useRef } from 'react' import s from './Sidebar.module.css' import cn from 'classnames' -import { - disableBodyScroll, - enableBodyScroll, - clearAllBodyScrollLocks, -} from 'body-scroll-lock' +import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock' interface SidebarProps { children: any @@ -34,7 +30,6 @@ const Sidebar: FC = ({ children, onClose }) => { } return () => { - if (contentElement) enableBodyScroll(contentElement) clearAllBodyScrollLocks() } }, [])