useIntersectionObserver default threshold #2184
Unanswered
pau-santesmasses
asked this question in
Q&A
Replies: 1 comment
-
I agree with this. I wasted time today, by not realizing that the default is 0.1. I was confused because there is no mention of it on the official documentation page or in the JSDoc. It was only when I looked at the source code to find the bug that I realized the default was 0.1. This should at least be stated somewhere to prevent cases like mine from happening. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a good reason for the default threshold value of useIntersectionObserver to be 0.1? Since that is a percentage of the element height, large elements can behave unexpectedly, e.g. a tall div may be reported as not intersecting when it's clearly within the viewport. Overriding the threshold with a value of 0 fixes it, and it seems it would have consistent behavior regardless of the element size. It is also the default for the underlying IntersectionObserver API.
Any insight greatly appreciated!
vueuse/packages/core/useIntersectionObserver/index.ts
Line 42 in 3309811
Beta Was this translation helpful? Give feedback.
All reactions