Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should isIntersecting be depended on the threshold value? #345

Closed
alisaitbilgi opened this issue Feb 8, 2019 · 2 comments
Closed

Should isIntersecting be depended on the threshold value? #345

alisaitbilgi opened this issue Feb 8, 2019 · 2 comments

Comments

@alisaitbilgi
Copy link

isIntersecting value (as spec says) is false in two conditions. Target has no intersections with the root or when the boundingClientRect has zero area. However, I've realized that on Chrome the value of isIntersecting is depending on the threshold value. On the other hand Firefox doesn't make the isIntersecting value false when target gets lost the intersection with the root. Polyfill has the same implementation as the spec says. And on MDN the explanation is: "If isIntersecting is true, the target element has become at least as visible as the threshold that was passed. If it's false, the target is no longer as visible as the given threshold."

So, which one must be selected? I think it is also related with #328

Chrome version: 72.0.3626.96 (Official Build) (64-bit)
Firefox version: 65.0 (64 bit)

@szager-chromium
Copy link
Collaborator

When boundingClientRect has zero area, the following states are possible:

If target is intersecting:
isIntersecting=true
intersectionRatio=1

If target is not intersecting:
isIntersecting=false
intersectionRatio=0

That's true no matter what the threshold values are.

@szager-chromium
Copy link
Collaborator

This is discussed in some detail in #432, especially:

#432 (comment)

I'm closing this issue, further discussion should happen on #432.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants