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

Initial display doesn't respect threshold value. #357

Closed
addlistener opened this issue Apr 19, 2019 · 4 comments
Closed

Initial display doesn't respect threshold value. #357

addlistener opened this issue Apr 19, 2019 · 4 comments
Labels

Comments

@addlistener
Copy link

addlistener commented Apr 19, 2019

if (!oldEntry) {
this._queuedEntries.push(newEntry);
} else if (rootIsInDom && rootContainsTarget) {
// If the new entry intersection ratio has crossed any of the
// thresholds, add a new entry.
if (this._hasCrossedThreshold(oldEntry, newEntry)) {
this._queuedEntries.push(newEntry);
}
} else {
// If the root is not in the DOM or target is not contained within
// root but the previous entry for this target had an intersection,
// add a new record indicating removal.
if (oldEntry && oldEntry.isIntersecting) {
this._queuedEntries.push(newEntry);
}
}
}, this);

@philipwalton Hi, Phillip! As I've found during my development process. When an entry is moved in or out of root element, the code doesn't run _hasCrossedThreshold . Is this behavior expected?

The MDN docs doesn't specify the behavior on show/hide, it just says when crossing the threshold the callback should be triggered. https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#Intersection_change_callbacks

I tested on my Chrome 73 OSX, show/hide respects threshold value. However the native implementation of an android 4.4.4 native browser at hand behave just like your code does.

If this is the wrong behavior, I'd like to submit a pull request. And please let me know if this is intended.

@miketaylr
Copy link
Member

However the native implementation of an android 4.4.4 native browser at hand behave just like your code does.

@jchnxu Some three years later, do more modern version of Android browser (Chrome?) still have this bug?

@miketaylr
Copy link
Member

The polyfill is being removed in #499 (see #433 for discussion).

If you can still reproduce bugs in the native implementations, filing bugs in the various bug tracks would be really helpful.

I'm going to close this as wontfix, but thanks for taking the time to report this issue!

@miketaylr miketaylr closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2022
@addlistener
Copy link
Author

However the native implementation of an android 4.4.4 native browser at hand behave just like your code does.

@jchnxu Some three years later, do more modern version of Android browser (Chrome?) still have this bug?

However I don't have that phone anymore. I don't know so I guess you don't need to care about it.

@miketaylr
Copy link
Member

All good, thanks for the response.

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

No branches or pull requests

3 participants