Intersection Observer API is broken in Chrome 58.x - detects all elements as visible although there are not
Reported by
jarkko.v...@gmail.com,
Apr 20 2017
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.81 Safari/537.36 Steps to reproduce the problem: 1. Open the observerbug.html file What is the expected behavior? Status div should report that only card0, card1 and card2 became visible What went wrong? Status div reports that Intersection Observer API thinks that all cards became visible. Did this work before? Yes Latest 57.x release before the first stable 58.x release Does this work in other browsers? N/A Chrome version: 58.0.3029.81 Channel: stable OS Version: 6.3 Flash Version: This causes a serious problem to one of my key products. Fix should be prioritized.
,
Apr 20 2017
,
Apr 21 2017
,
Apr 21 2017
see https://github.com/WICG/IntersectionObserver/issues/165, there was an intentional change in Chrome 58.
,
Apr 21 2017
Tested the issue on Windows 7 , ubuntu 14.04 and mac os 10.12.3 using chrome M58 #58.0.3029.81 and is reproduced. Issue is a regression issue broken in "M58" and is reproducible in latest chrome ,beta , dev and canary channels. Using the per-revision bisect providing the bisect results, Good build:58.0.2988.0 (Revision: 445280). Bad build: 58.0.3000.0 (Revision: 447669). You are probably looking for a change made after 447298 (known good), but no later than 447299 (first known bad). CHANGELOG URL: The script might not always return single CL as suspectas some perf builds might get missing due to failure. https://chromium.googlesource.com/chromium/src/+log/9d72c664ac08275bbde7dbb4bfd350416302d4f4..c9092d27fc367898890811f6bb75893bc2200755 From the CL above, assigning the issue to the concern owner @szager - Could you please check whether this is caused with respect to your change, if not please help us in assigning it to the right owner. Review-Url: https://codereview.chromium.org/2645283008 Thanks!
,
Apr 21 2017
Since the API was intentionally changed, the observer callback function needs to check whether the element is actually visible since the callback is now immediately called when observer.observe(target) is invoked. Here's a demo how to get correct behaviour: http://www.sci.fi/~jviinama/chrome/observerbug-fixed.html This code works both with Chrome 57.x and Chrome 58.x. Note however that event property "isIntersecting" is not available in Chrome <58, so we need to check intersectionRatio to make the decision.
,
Apr 21 2017
For most cases, checking intersectionRatio should be sufficient. The new isIntersecting field is meant to address the case of an edge-adjacent intersection (i.e., both target and root have non-zero area, and they overlap on an edge). In that case, the intersectionRect will be all zero's and the intersectionRatio will be zero, but IntersectionObserver sets isIntersecting to be true. This is working as intended; closing bug.
,
Jun 9 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by jarkko.v...@gmail.com
, Apr 20 2017