IntersectionObserver.prototype.observe doesn't always trigger the callback for already-in-view items |
||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2738.0 Safari/537.36 Example URL: http://s.codepen.io/philipwalton/debug/vGwXbg Steps to reproduce the problem: 1. Visit http://s.codepen.io/philipwalton/debug/vGwXbg in any version of Chrome that supports IntersectionObserver 2. Open up the console. 3. Notice that the string "Intersection happened..." is not being logged unless you scroll or click or otherwise interact with the page. What is the expected behavior? The InteractionObserver callback should always be invoked after calling `.observe` if the element is already in view. What went wrong? It seems that the setTimeout is deferring the `.observe` call to a point after which no new frames are immediately made, so the callback doesn't happen. The `.observe` method should probably always schedule a new frame. Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? No Does this work in other browsers? N/A Chrome version: 52.0.2738.0 Channel: canary OS Version: OS X 10.11.4 Flash Version: Shockwave Flash 22.0 r0
,
May 17 2016
Tested the same on mac 10.11, win8.1 and Linux 14.04 chrome version 52.0.2738.0, 52.0.2729.3 and 51.0.2704.47 - the string "Intersection happened..." is displayed in console only after interacting with page. Observed the error "Uncaught ReferenceError: IntersectionObserver is not defined" is displayed on mac 10.11 chrome version 50.0.2661.102 Confirming and assigning the issue for further inputs on this.
,
May 17 2016
,
May 23 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9d6cc87951566e8fc9be1a04fefb2054f870ab1e commit 9d6cc87951566e8fc9be1a04fefb2054f870ab1e Author: szager <szager@chromium.org> Date: Mon May 23 23:25:48 2016 Schedule a frame from IntersectionObserver::observe. If the target is intersecting the root when observe() is called, a notification should be queued up immediately, but if no frame is scheduled, then the intersection algorithm will not run. BUG= 612323 R=ojan@chromium.org,eae@chromium.org Review-Url: https://codereview.chromium.org/1988633002 Cr-Commit-Position: refs/heads/master@{#395460} [modify] https://crrev.com/9d6cc87951566e8fc9be1a04fefb2054f870ab1e/third_party/WebKit/Source/core/dom/IntersectionObserver.cpp [modify] https://crrev.com/9d6cc87951566e8fc9be1a04fefb2054f870ab1e/third_party/WebKit/Source/core/dom/IntersectionObserver.h [add] https://crrev.com/9d6cc87951566e8fc9be1a04fefb2054f870ab1e/third_party/WebKit/Source/web/tests/IntersectionObserverTest.cpp [modify] https://crrev.com/9d6cc87951566e8fc9be1a04fefb2054f870ab1e/third_party/WebKit/Source/web/web.gypi [modify] https://crrev.com/9d6cc87951566e8fc9be1a04fefb2054f870ab1e/third_party/WebKit/Source/web/web_tests.gyp
,
Jun 1 2016
,
Jul 29 2016
Stefan, do you know which version has this fix? I got a question from an interested third party reporting that the issue was still in M52 (v52.0.2743.82 OSX) M54: fix confirmed. M53: not tested.
,
Aug 1 2016
It's in M53, but not M52
,
Aug 24 2016
Sorry to insist, but the bug is still there on my Chrome 52.0.2743.116 Stable channel / OS X 10.11.6 Let me clarify my testing steps: 1. Visit http://s.codepen.io/philipwalton/debug/vGwXbg 2. Open up the console. 3. The string "Intersection happened..." is being logged (because opening the console *is* an interaction). 4. Reload the page, while console is opened. 5. Notice that the string "Intersection happened..." is not being logged unless you scroll or click or otherwise interact with the page.
,
Aug 24 2016
Sorry Stefan, i did not read your answer. It is ok for me: 52 is not fixed, 53 is.
,
Aug 25 2016
Updating the label to reflect the actual status. |
||||
►
Sign in to add a comment |
||||
Comment 1 by dmu...@chromium.org
, May 17 2016Owner: szager@chromium.org