-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: update cumulative-layout-shift #12554
Conversation
// The original Cumulative Layout Shift metric, the sum of main-frame shift events from the entire trace. | ||
const oldCumulativeLayoutShift = mainFrameShiftEvents | ||
.reduce((sum, e) => sum += e.weightedScore, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
calculateOldCumulativeLayoutShift
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yeah, thanks
ok, we're going with |
Fixes #12350, part of #11866
As discussed in that issue, CLS is being switched to the
max-session-gap1s-limit5s
variant with LayoutShift events from the whole frame tree ("all frames") to align with the broader web-vitals CLS change.The new version will result in unchanging or better CLS values for all users by design, but since Lighthouse currently only measures CLS during page load, most users won't see much meaningful change in their CLS (we currently estimate that about 5% of sites will go from a poor to average rating, and about 3% of sites will move from average to passing).
This PR touches a lot of files, but the primary change is moving the winning variant in
layout-shift-variants
to thecumulative-layout-shift
computed artifact (with much oflayout-shift-variants-test
making a similar journey) and then updating a ton of test expectations.The computed artifact also exposes a
cumulativeLayoutShiftMainFrame
for a only-main-frame version of the metric, and an(edit: we went witholdCumulativeLayoutShift
totalCumulativeLayoutShift
) which is the original CLS for developers who still want to track it.I can't remember what we finally decided to call that and #12350 isn't clear, so that'll be the first thing we can fix in review :)