GoogleChrome / web-vitals-extension

A Chrome extension to measure essential metrics for a healthy site
https://chrome.google.com/webstore/detail/web-vitals/ahfhijdlegdabablpippeagghigmibma?hl=en
Apache License 2.0
2.35k stars 105 forks source link

Metrics reset after visibility change #101

Closed rviscomi closed 2 years ago

rviscomi commented 2 years ago

Steps to reproduce:

  1. Go to https://www.cnn.com/
  2. Change tabs to hide CNN
  3. Return to the CNN tab
  4. Click the hamburger menu on the top left of the page image

HUD after Step 1 and Step 3:

image

HUD after Step 4:

image
rviscomi commented 2 years ago

After some investigation, I don't think this bug was caused by the INP changes, but they do make the bug more easily reproducible.

You can also reproduce this using the production version of the extension. Instead of triggering INP after the page visibility change, try to trigger CLS. For example, go to https://www.nytimes.com/ and scroll down the entire page after the visibility change. There should be an increase to CLS, and LCP will be reset to 0.

Initial state:

image

After a visibility change and scrolling:

image

The expected behavior is for metrics to persist their values across visibility changes.