mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 12:40:40 +08:00
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:
parent
fd83107674
commit
65c03af919
|
@ -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 = () => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user