-
Notifications
You must be signed in to change notification settings - Fork 293
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
Time to Interactive calculation when Visibility is Hidden #248
Comments
Hello @nicjansma I would like to have 2 parts (A and B) in this comment: A. Reproducing issue when we have very high TTI. I managed to reproduce the issue that Jud White has reported here: #245 Steps for manual test:
Next step will be to try to recreate this in e2e test find out the real reason why this happens. B. Metrics that may not be correct when page is loaded in hidden tab. We could execute one of the points below but I am not sure how often this happens and before I really implement something I would like to see some real life: If the page loaded hidden we do not send:
|
Hello @nicjansma I looked deeper at this problem and it became obvious that we do wrong calculations because of the way setTimeout() works in inactive browser tabs. In Continuity plugin we are wrapping the call of checkTti() in setTimeout(). Conclusion from my experiments and what I read regarding setTimeout() behavior in inactive tabs is that it does not execute while the tab is inactive/hidden. On the other hand TTVR had fine value. I see 2 possible options:
Good place where we can implement this is: impl.timeline.analyze() Reference to checkTti():
|
We should ensure the Time to Visually Ready (TTVR) and Time to Interactive (TTI) metrics are correct (or skipped) when the page is loaded hidden (or goes through hidden-visible transitions).
If the page loads hidden, the First Paint and First Contentful Paint events may not fire until the page is foregrounded. In addition,
setTimeout
,requestAnimationFrame
and other things we use to monitor TTVR/TTI may not fire reliably. In many cases, it's not until the page comes back to visible that these paints/callbacks happen. This can skew our calculations and make TTVR/TTI reflect the user-interaction (of foregrounding) rather than the page's lifecycle.Related:
document.visibilityState === 'hidden'
w3c/paint-timing#40The text was updated successfully, but these errors were encountered: