Skip to content

fix: show CLS metric when value is 0#4797

Open
fuleinist wants to merge 2 commits into
sitespeedio:mainfrom
fuleinist:fix/cls-zero-display
Open

fix: show CLS metric when value is 0#4797
fuleinist wants to merge 2 commits into
sitespeedio:mainfrom
fuleinist:fix/cls-zero-display

Conversation

@fuleinist

Copy link
Copy Markdown

Description

When Chrome's Layout Instability API observer never fires (no layout shifts on the page), \cumulativeLayoutShift\ stays \undefined. The aggregator skipped it entirely, so no stats were generated and the template never rendered the CLS section — making it look like the metric was missing.

Root cause

In \�rowsertimeAggregator.js, the guard !== undefined\ prevented pushing a 0 value when the observer never fired. The Pug templates had matching guards that hid the entire CLS section.

Fix

  1. browsertimeAggregator.js — default to \

When Chrome's Layout Instability API observer never fires (no layout
shifts on the page), cumulativeLayoutShift stays undefined. The
aggregator skipped it entirely, so no stats were generated and the
template never rendered the CLS section.

Fix: default to 0 in the aggregator when pageinfo exists but CLS is
undefined, and relax the template guards so they render for any
pageinfo (not just when CLS !== undefined).

Fixes sitespeedio#4547
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant