mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
fixed scroll locks on SidebarWrapper
This commit is contained in:
parent
f354b4aacc
commit
892e40c87e
2 changed files with 5 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
|||
import React, { FC, useEffect, useRef } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
|
||||
import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
|
||||
import { useCloseOnEscape } from '~/utils/hooks';
|
||||
|
||||
interface IProps {
|
||||
|
@ -17,7 +17,7 @@ const SidebarWrapper: FC<IProps> = ({ children, onClose }) => {
|
|||
if (!ref.current) return;
|
||||
disableBodyScroll(ref.current, { reserveScrollBarGap: true });
|
||||
|
||||
return () => enableBodyScroll(ref.current);
|
||||
return () => clearAllBodyScrollLocks();
|
||||
}, [ref.current]);
|
||||
|
||||
return createPortal(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue