You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code may lead to very subtle bugs because, per the spec, an element may still be "intersecting" even though intersectionRatio is 0. For instance, this situation is possible:
{isIntersecting: true,intersectionRatio: 0}
This is due to how edge adjacency works, and you can read the gory details here (w3c/IntersectionObserver#222). You can repro this by scrolling such that the element perfectly overlaps the root (may be easiest to repro in Firefox currently).
My recommendation would be to change the if() statement to
The case where typeof entry.isIntersecting isn't a boolean covers Edge 15, which does not support isIntersecting, and where entry.intersectionRatio === 0 is actually a safe proxy for "no longer intersecting."
The text was updated successfully, but these errors were encountered:
This code may lead to very subtle bugs because, per the spec, an element may still be "intersecting" even though
intersectionRatio
is 0. For instance, this situation is possible:This is due to how edge adjacency works, and you can read the gory details here (w3c/IntersectionObserver#222). You can repro this by scrolling such that the element perfectly overlaps the root (may be easiest to repro in Firefox currently).
My recommendation would be to change the
if()
statement toThe case where
typeof entry.isIntersecting
isn't a boolean covers Edge 15, which does not supportisIntersecting
, and whereentry.intersectionRatio === 0
is actually a safe proxy for "no longer intersecting."The text was updated successfully, but these errors were encountered: