IntersectionObserver stops invoking callback in a background tab
Reported by
simon....@gmail.com,
Apr 17 2018
|
|||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:59.0) Gecko/20100101 Firefox/59.0 Steps to reproduce the problem: https://codepen.io/simonpai/pen/BxBBbR 1. Open the link above. Open the console to see intersectionRatio reported every 2 secs. 2. Switch to another tab. IntersectionObserver stops to invoke the callback. What is the expected behavior? AFAICS the w3c does not explicitly specify the behavior in a background tab, so I am certain if this should be considered as a defect. But since it is unspecified, I would expect it behaves the same as in active tabs. In FireFox, IntersectionObserver works as expected, and they explicitly state the behavior in their documentation: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API What went wrong? IntersectionObserver stops invoking callback in a background tab Did this work before? N/A Does this work in other browsers? N/A Chrome version: 65.0.3325.146 Channel: stable OS Version: OS X 10.12 Flash Version: Shockwave Flash 29.0 r0 I think it's up to Chrome team to define IntersectionObserver's behavior in background tabs. However, it's a fact that in the current state Chrome offers a weaker API than FireFox, as it gives us less information, especially inside an iframe. In addition, I may have to ditch the use of IntersectionObserver with Chrome, falling back to the traditional way (setInterval + getBoundingClientRect), which ironically counteracts the performance purpose of throttling cycles in background tabs.
,
Apr 17 2018
,
Apr 18 2018
,
Apr 18 2018
Unable to reproduce the issue on chrome reported version 833725 using Mac 10.12.6 with steps mentioned below: 1) Launch chrome reported version and navigated to URL: https://codepen.io/simonpai/pen/BxBBbR 2) Opened Devtools>Console, able to see intersectionratio invoking 3) Switched to new tab and again checked the Intersectionratio invoking @Reporter: Please find the attached screencast for your reference and let us know if we missed anything in reproducing the issue, provide your feedback on it which help in further triaging it in better way. Thanks!
,
Apr 18 2018
Hi, Thank you for your quick response and sorry for causing misunderstanding. What I stated was that the IntersectionObserver does not work WHEN the tab is in background. As you switch back to the tab, of course it comes back alive and starts to invoke the callback. Please detach your console from the original browser window and observe it during the time period when you switch off to another tab. Thanks!
,
Apr 18 2018
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Apr 23 2018
,
Apr 23 2018
This is working as intended. IntersectionObserver is integrated into the frame rendering pipeline, which doesn't run for tabs in the background. I'm curious, though, about the assertion than "Chrome offers a weaker API than FireFox." I would be surprised to learn that Firefox does something different here; is that the case?
,
Apr 24 2018
Yes, I have supplied the reference link. Please read Comment 1 of this thread. Thanks for your effort! |
|||||||
►
Sign in to add a comment |
|||||||
Comment 1 by simon....@gmail.com
, Apr 17 2018