check null for document.body and document.documentElement inside function isWindowScrollable (#2028)

This commit is contained in:
Shuchang Zheng
2025-03-27 00:26:41 -07:00
committed by GitHub
parent 2c6098c84e
commit 62591eff85

View File

@@ -1993,11 +1993,15 @@ async function scrollToNextPage(
}
function isWindowScrollable() {
const documentBody = document.body;
const documentElement = document.documentElement;
if (!documentBody || !documentElement) {
return false;
}
// Check if the body's overflow style is set to hidden
const bodyOverflow = getElementComputedStyle(document.body)?.overflow;
const htmlOverflow = getElementComputedStyle(
document.documentElement,
)?.overflow;
const bodyOverflow = getElementComputedStyle(documentBody)?.overflow;
const htmlOverflow = getElementComputedStyle(documentElement)?.overflow;
// Check if the document height is greater than the window height
const isScrollable =