High CLS caused by Next.js router navigation due to layout shift between short and long pages #78923
Unanswered
yanghoxom
asked this question in
App Router
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm encountering a high Cumulative Layout Shift (CLS) score on my Next.js website, and it seems to be related to how next/router handles client-side navigation.
Since Next.js uses client-side routing with next/router, navigating between pages doesn't trigger a full reload. This creates a problem when switching from a page with short content (where the footer is visible in the first viewport) to a page with longer content (where the footer is pushed far down).
The browser sees this as a significant layout shift — the footer appears in one position initially, then jumps out of view as the longer content loads, which increases the CLS score.
Has anyone faced a similar issue? Is there a best practice or workaround to prevent this CLS increase during navigation?
Thanks in advance!
I used this code to check CLS when navigate
and, when I go to long page from short page, I got this
Beta Was this translation helpful? Give feedback.
All reactions