Code Monkey home page Code Monkey logo

Comments (1)

tunetheweb avatar tunetheweb commented on September 23, 2024

This intentionally for LCP and CLS but should not be the case for FID.

LCP is not "finalised" until there is either an interaction or a the page is navigated away from (when a page is hidden we also emit the LCP event as sometimes people come back so it's more a proxy for navigating way, rather than ideal). This is because the page might still be loading and another, later, bigger LCP element could still be drawn.

Your options are either to enable reportAllChanges - but then multiple LCP events may be reported, or you can simulate a click to finalise the LCP, or you can create (or emulate) a visibility change. You can see we use all three in our test cases: https://github.com/GoogleChrome/web-vitals/blob/main/test/e2e/onLCP-test.js

CLS is a similar situation, except click does not finalize CLS so that's not the an option for you. We have a stubVisibilityChange function to emulate a visibility change and finalise the CLS, and again you can see this in our test suite: https://github.com/GoogleChrome/web-vitals/blob/main/test/e2e/onCLS-test.js

FID should be emitted as soon as the first interaction happens. But a FID of 0 is not emitted if there are no interactions. So you must emulate a click (or some other interaction) for it to emit.

from web-vitals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.