mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-04 21:58:39 -05:00
fix: lock body scroll when using webkit (#3399)
This commit is contained in:
@@ -15,13 +15,20 @@ export const useLockBodyScroll = (
|
|||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
): void => {
|
): void => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const originalStyle = window.getComputedStyle(document.body).overflow;
|
const originalOverflowStyle = window.getComputedStyle(
|
||||||
|
document.body
|
||||||
|
).overflow;
|
||||||
|
const originalTouchActionStyle = window.getComputedStyle(
|
||||||
|
document.body
|
||||||
|
).touchAction;
|
||||||
if (isLocked && !disabled) {
|
if (isLocked && !disabled) {
|
||||||
document.body.style.overflow = 'hidden';
|
document.body.style.overflow = 'hidden';
|
||||||
|
document.body.style.touchAction = 'none';
|
||||||
}
|
}
|
||||||
return () => {
|
return () => {
|
||||||
if (!disabled) {
|
if (!disabled) {
|
||||||
document.body.style.overflow = originalStyle;
|
document.body.style.overflow = originalOverflowStyle;
|
||||||
|
document.body.style.touchAction = originalTouchActionStyle;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}, [isLocked, disabled]);
|
}, [isLocked, disabled]);
|
||||||
|
|||||||
Reference in New Issue
Block a user