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

The ambiguity of intersectionRatio. #488

Open
joekingTheThird3 opened this issue Nov 2, 2021 · 1 comment
Open

The ambiguity of intersectionRatio. #488

joekingTheThird3 opened this issue Nov 2, 2021 · 1 comment

Comments

@joekingTheThird3
Copy link

This is usually zero or larger. But the zero value is still valid and means at least 1 pixel is 'intersecting'. I've seen repeated code test just the intersectionRatio, 'intersectionRatio > 0'. This can cause some issues when scrolling because if it is zero then the test would miss the movement of the target element inside the root. I usually change the test to >= 0. I also test the isIntersecting property. I think people are using this shortcut for 'has this element moved inside the area I want to observe'. IntersectionRatio can never be less than zero? Maybe it should?

@miketaylr
Copy link
Member

@joekingTheThird3 could you clarify what you're asking for or proposing here?

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

No branches or pull requests

2 participants