FIX: prevents body scroll to hide sticky elements (#26400)

Applying `overflow: hidden` was not playing well with sticky elements (like the header for example). It appears that we don't really need this to achieve our goal so Im removing this part of body scroll lock for now.
This commit is contained in:
Joffrey JAFFEUX 2024-03-27 15:21:19 +01:00 committed by GitHub
parent fd83107674
commit 65c03af919
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,7 +45,6 @@ let locks = [];
let locksIndex = /* @__PURE__ */ new Map();
let documentListenerAdded = false;
let initialClientY = -1;
let previousBodyOverflowSetting;
let htmlStyle;
let bodyStyle;
let previousBodyPaddingRight;
@ -89,20 +88,12 @@ const setOverflowHidden = (options) => {
}px`;
}
}
if (previousBodyOverflowSetting === void 0) {
previousBodyOverflowSetting = document.body.style.overflow;
document.body.style.overflow = "hidden";
}
};
const restoreOverflowSetting = () => {
if (previousBodyPaddingRight !== void 0) {
document.body.style.paddingRight = previousBodyPaddingRight;
previousBodyPaddingRight = void 0;
}
if (previousBodyOverflowSetting !== void 0) {
document.body.style.overflow = previousBodyOverflowSetting;
previousBodyOverflowSetting = void 0;
}
};
const setPositionFixed = () =>
window.requestAnimationFrame(() => {
@ -119,17 +110,6 @@ const setPositionFixed = () =>
$body.style.left = `${-scrollX}px`;
$body.style.width = "100%";
$body.style.height = "auto";
$body.style.overflow = "hidden";
setTimeout(
() =>
window.requestAnimationFrame(() => {
const bottomBarHeight = innerHeight - window.innerHeight;
if (bottomBarHeight && scrollY >= innerHeight) {
$body.style.top = -(scrollY + bottomBarHeight) + "px";
}
}),
300
);
}
});
const restorePositionSetting = () => {