Commit d585dbd4 authored by Ian Jones's avatar Ian Jones

guard clause earlier

parent b11ba67e
......@@ -120,6 +120,10 @@ function findDOMNode(
* Check if a HTMLElement is hidden or fixed/sticky position
*/
function shouldSkipElement(element: HTMLElement) {
if (element.tagName === 'HTML' || element.tagName === 'BODY') {
return false
}
// we ignore fixed or sticky positioned elements since they'll likely pass the "in-viewport" check
// and will result in a situation we bail on scroll because of something like a fixed nav,
// even though the actual page content is offscreen
......@@ -133,11 +137,7 @@ function shouldSkipElement(element: HTMLElement) {
return true
}
return (
element.offsetParent === null &&
element.tagName !== 'HTML' &&
element.tagName !== 'BODY'
)
return element.offsetParent === null
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment