Repository navigation
Description
Description
This is a resubmission of the Intersection Observer v2 from last year Interop proposal.
Intersection Observer v2 introduces the concept of tracking the actual "visibility" of a target element as a human being would define it. By setting an option in the IntersectionObserver constructor, intersecting IntersectionObserverEntry instances will then contain a new boolean field named isVisible. A true value for isVisible is a strong guarantee from the underlying implementation that the target element is completely unoccluded by other content and has no visual effects applied that would alter or distort its display on screen. In contrast, a false value means that the implementation cannot make that guarantee.
An important detail of the spec is that the implementation is permitted to report false negatives (that is, setting isVisible to false even when the target element is completely visible and unmodified). For performance or other reasons, browsers limit themselves to working with bounding boxes and rectilinear geometry; they don't try to achieve pixel-perfect results for modifications like border-radius.
That said, false positives are not permitted under any circumstances (that is, setting isVisible to true when the target element is not completely visible and unmodified).
The IntersectionObserver constructor now takes two additional configuration properties: delay and trackVisibility. The delay is a number indicating the minimum delay in milliseconds between notifications from the observer for a given target. The trackVisibility is a boolean indicating whether the observer will track changes in a target's visibility.
This information is from the following source
Supporting links:
Delay
TrackVisibility
isVisible
Specification
Open Issues
No response
Tests
Current Implementations
- Blink
- Gecko
- WebKit
Standards Positions
-
Blink intent to Implementing: https://groups.google.com/a/chromium.org/g/blink-dev/c/tudxAHN9-AY/m/vz91o_aNDwAJ?pli=1
-
Mozilla not found
-
WebKit not found
Browser bug reports
No response
Developer discussions
No response
Polls & Surveys
No response
Existing Usage
-
Chrome's usecounter is at 5.7% of pageloads (https://chromestatus.com/metrics/feature/timeline/popularity/3051) which indicates developer interest in this feature as it is steadily growing. Cross browser compatibility would even further speed up the adoption.
-
In the Results of MDN APIs & JavaScript survey #246, "Intersection Observer" was selected by ~15% of survey takers
-
example implementation from Chrome: https://trick-ad-click.glitch.me/
Workarounds
No response
Accessibility Impact
No response
Privacy Impact
No response
Other
V2 is supported by Chrome but not on Firefox and Safari. Its not even mentioned in the MDN doc, an open issue for the MDN doc is open here mdn/content#19201
Chrome, Edge, Safari and Firefox have shipped V1 of IntersectionObserver. The V2 proposal is a relatively small change to the spec, but unfortunately not supported by all.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
BearCooder commentedon Oct 2, 2023
With 1. October we can see a jump to 6.4: https://chromestatus.com/metrics/feature/timeline/popularity/3051
npdoty commentedon Oct 3, 2023
This interop focus proposal -- and the linked version of the spec -- makes no mention of the privacy impacts of an API apparently designed primarily to reveal information about what the user has seen to third parties.
gsnedders commentedon Oct 19, 2023
What's the status of the spec? This v2 draft is dated 2019, and links to https://www.w3.org/TR/intersection-observer/ as the "latest published version" (which appears to be v1, but 2023). Is there no FPWD of v2? If so, it would appear the spec doesn't meet the bar we asked for, for W3C documents (REC-track).
szager-chromium commentedon Nov 6, 2023
@gsnedders -- we're trying to build consensus among browser vendors to implement this spec (issue). If that's successful, then my plan is to create a PR for the main branch of the spec repository containing all of the V2 language.
wpt-interop commentedon Feb 1, 2024
Thank you for proposing Intersection Observer v2 for inclusion in Interop 2024.
We wanted to let you know that this proposal was not selected to be part of Interop this year.
As of the deadline, the specifications for Intersection Observer v2 were not yet complete enough to allow interoperable implementations. To make progress on this area in the future, it will first be necessary to ensure that the feature has a clear specification in a standards track document.
For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2024!
Posted on behalf of the Interop team.
bkardell commentedon Feb 1, 2024
BearCooder commentedon Sep 27, 2024
Hello @szager-chromium any progress on ths spec? Chrome's usecounter is at over 8% of pageloads.
szager-chromium commentedon Sep 27, 2024
@BearCooder -- Mozilla has taken a positive standards position, and the V2 feature set has been merged into the spec. The only thing left to do is to implement it in all browsers.