Core Web Vitals CLS Does Not Count Layout Shifts Caused by Resizing
Layout shifts that happen when you resize the browser window or rotate a phone to landscape are not counted in Core Web Vitals CLS (Cumulative Layout Shift). The specification defines it that way. In my test environment, these shifts also had hadRecentInput=true when I changed the screen size. CLS stayed at 0, and web-vitals' onCLS did not report a new value.
However, the exclusion only lasts for 500ms after the screen size changes. On a page that switches its display in JavaScript in response to a resize event, a shift from a switch that happened 550ms later was counted in CLS. I show the test numbers for how a process that rebuilds the display to fit the screen width affects CLS on a responsive page.
The test environment was Ubuntu 24.04, Node.js 22, and web-vitals 5.3.0. The browser was Chromium 158 (headless) bundled with Playwright 1.63.0. The initial viewport was 412px wide and 823px high. I changed the screen size with Playwright's page.setViewportSize and with Browser.setWindowBounds from the Chrome DevTools Protocol, which changes the size of the window itself. I did not test dragging a window edge with a mouse, rotating a real phone, the retail version of Chrome or browsers other than Chromium, Lighthouse, or real-user data (such as PageSpeed Insights field data or Search Console).
The test page
The page has six pairs of paragraphs and cards below the header. The paragraph text is long, so the line breaks change as the screen width changes, and the cards below move up and down.
Adding the URL parameter notice makes the page insert a notice band below the header a specified number of milliseconds after a resize event. This simulates a process that waits briefly before switching the display after the screen width changes.
// notice=delay in ms: after resize, insert the notice band after the given number of milliseconds
const notice = p.has('notice') ? Number(p.get('notice')) : null;
const insert = () => { … document.getElementById('slot').prepend(d); };
…
… addEventListener('resize', () => { if (notice === 0) insert(); else setTimeout(insert, notice); }, { once: true });
(I omitted the code that builds the band, the conditional branches, and the handling of the other parameters.)
On the page, I used a PerformanceObserver to receive layout-shift entries and recorded the time, value, hadRecentInput, and lastInputTime of each shift. I also registered web-vitals' onCLS with reportAllChanges: true and recorded the CLS values it reported. I ran the measurements with a Playwright script and changed the screen size about 1 second after the page opened. All times in the output below are milliseconds since the page opened.
Narrowing the width and rotating to landscape did not count the shifts
When I narrowed the width from 412px to 360px, the paragraph line breaks changed and the elements below them moved. The entry's sources contained the maximum of 5 items. This shift had hadRecentInput=true. onCLS reported 0 right after the page opened and did not report again.
== narrow (1000ms ごろに 412x823 → 360x823)
resize event t=1021 innerWidth=360 innerHeight=823
shift t=1021 value=0.0696 hadRecentInput=true lastInputTime=1007 sources=5
onCLS report at=54 value=0.0000 entries=[]
I also swapped the width and height to match a phone rotated to landscape (823×412). The result was the same.
== rotate (1000ms ごろに 412x823 → 823x412)
resize event t=1032 innerWidth=823 innerHeight=412
shift t=1032 value=0.0732 hadRecentInput=true lastInputTime=1017 sources=3
onCLS report at=40 value=0.0000 entries=[]
In both cases, lastInputTime matches the time just before the shift. The change in screen size was recorded as the most recent input.
The draft spec for the Layout Instability API defines the inputs that hadRecentInput is based on (excluding input) as "input device events that show the user is interacting with the document, or events that directly change the size of the viewport." Changing the screen size is treated the same way as a click or a key press. lastInputTime is the time of the most recent such input, and any shift less than 500ms after it gets hadRecentInput=true. In the Chromium source on the layout_shift_tracker.cc file on the main branch as of November 2026, the handler for a viewport size change (NotifyViewportSizeChanged) also updates the input time to the current time.
web-vitals' onCLS skips shifts that have hadRecentInput set (LayoutShiftManager.ts). As a result, shifts caused by changing the screen size did not enter CLS.
When I narrowed the window itself by 52px with Browser.setWindowBounds, the width became 360px. The shift of the same value also had hadRecentInput=true (this is the first shift in the window notice=300 output in a later section).
Display switches within 500ms were also excluded
The exclusion does not apply only to shifts caused directly by the screen size change. If a band was inserted by JavaScript within 500ms of a resize, that shift also had hadRecentInput=true.
This output is from inserting the band 300ms after the resize event. The second shift (t=1329) came from the band and was not counted in CLS.
== narrow-notice-300 (1000ms ごろに 412x823 → 360x823, ?notice=300)
resize event t=1019 innerWidth=360 innerHeight=823
shift t=1019 value=0.0696 hadRecentInput=true lastInputTime=1005 sources=5
shift t=1329 value=0.0784 hadRecentInput=true lastInputTime=1005 sources=1
onCLS report at=40 value=0.0000 entries=[]
When I inserted the band 550ms later, the shift from the band had hadRecentInput=false, and onCLS reported a CLS of 0.0784.
== narrow-notice-550 (1000ms ごろに 412x823 → 360x823, ?notice=550)
resize event t=1031 innerWidth=360 innerHeight=823
shift t=1031 value=0.0696 hadRecentInput=true lastInputTime=1017 sources=5
shift t=1585 value=0.0784 hadRecentInput=false sources=1
onCLS report at=51 value=0.0000 entries=[]
onCLS report at=1586 value=0.0784 entries=[1585]
The value 0.0784 matches the CLS when the same band was inserted at about 1 second without changing the screen size. After 500ms, the shift was counted as a normal shift whether or not a resize had happened.
== no-resize-notice (画面の大きさは変えない, ?notice=-1)
shift t=1018 value=0.0784 hadRecentInput=false sources=1
onCLS report at=36 value=0.0000 entries=[]
onCLS report at=1019 value=0.0784 entries=[1018]
The following chart summarizes the results when the insertion delay was 0ms, 300ms, 450ms, 550ms, and 700ms. The boundary was between 450ms and 550ms.

When I changed the window size with Browser.setWindowBounds, the band inserted at 300ms was excluded, and the band inserted at 700ms was counted.
== window notice=300
window before 412 823 inner 412x823
resize event t=1025 innerWidth=360 innerHeight=823
shift t=1025 value=0.0696 hadRecentInput=true lastInputTime=1011 sources=5
shift t=1329 value=0.0784 hadRecentInput=true lastInputTime=1011 sources=1
onCLS report at=42 value=0.0000 entries=[]
== window notice=700
window before 412 823 inner 412x823
resize event t=1029 innerWidth=360 innerHeight=823
shift t=1028 value=0.0696 hadRecentInput=true lastInputTime=1014 sources=5
shift t=1733 value=0.0784 hadRecentInput=false sources=1
onCLS report at=48 value=0.0000 entries=[]
onCLS report at=1734 value=0.0784 entries=[1733]
The 500ms exclusion also started when only the height changed
Next, I kept the width the same and reduced only the height from 823px to 700px.
On a page with a 30vh-high block placed before the body text, the block shrank and the body moved up. That shift was excluded.
== short-vh (1000ms ごろに 412x823 → 412x700, ?vh=1)
resize event t=1030 innerWidth=412 innerHeight=700
shift t=1030 value=0.0318 hadRecentInput=true lastInputTime=1017 sources=1
onCLS report at=53 value=0.0000 entries=[]
On a page that does not use vh, reducing the height caused no shift. However, the band inserted 300ms later still had hadRecentInput=true. The 500ms exclusion started just because the screen size changed.
== short-notice-300 (1000ms ごろに 412x823 → 412x700, ?notice=300)
resize event t=1029 innerWidth=412 innerHeight=700
shift t=1335 value=0.0908 hadRecentInput=true lastInputTime=1015 sources=1
onCLS report at=47 value=0.0000 entries=[]
With gradual changes, the 500ms was counted from the last change
To check repeated small width changes, I used a page (with the debounce parameter) that narrowed the width by 10px five times at 200ms intervals. On each resize, the page restarted the wait timer before inserting the band.
With a 300ms wait, the shift 304ms after the last resize (t=1833) had hadRecentInput=true, and lastInputTime was 1819, just before the last resize.
== steps-debounce-300 (1000ms から 200ms おきに幅を 10px ずつ 5回狭める(412 → 362), ?debounce=300)
resize event t=1033 innerWidth=402 innerHeight=823
resize event t=1233 innerWidth=392 innerHeight=823
resize event t=1433 innerWidth=382 innerHeight=823
resize event t=1633 innerWidth=372 innerHeight=823
resize event t=1833 innerWidth=362 innerHeight=823
shift t=1433 value=0.0687 hadRecentInput=true lastInputTime=1419 sources=5
shift t=2137 value=0.0784 hadRecentInput=true lastInputTime=1819 sources=1
onCLS report at=40 value=0.0000 entries=[]
With a 600ms wait, the shift 604ms after the last resize (t=1818) was counted as a CLS of 0.0784. Counting from the first resize, both cases were more than 500ms in, but whether the exclusion ended depended on when the size last changed.
== steps-debounce-600 (1000ms から 200ms おきに幅を 10px ずつ 5回狭める(412 → 362), ?debounce=600)
…
resize event t=1818 innerWidth=362 innerHeight=823
shift t=1418 value=0.0687 hadRecentInput=true lastInputTime=1404 sources=5
shift t=2422 value=0.0784 hadRecentInput=false sources=1
onCLS report at=36 value=0.0000 entries=[]
onCLS report at=2423 value=0.0784 entries=[2422]
(I omitted the intermediate resize event lines.)
In these tests, the only shifts counted in CLS during the screen size measurements were shifts from a band inserted by JavaScript after a resize, when the shift happened more than 500ms after the last resize. Changes driven only by CSS, such as paragraph line breaks, happened as soon as the screen size changed and were excluded.





