question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v5 + emotion - increase in Cumulative Layout Shift

See original GitHub issue
  • [x ] The issue is present in the latest release.
  • [ x] I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I notice significant increase in CLS after upgrading project from v4 to v5 and refactoring makeStyles/useStyles to emotion.

Increase is from acceptable 0.059 on mobile and 0.006 desktop to 0.574 mobile and 0.869 desktop.

Project is next.js, the only change made is makeStyles => emotion refactoring.

It was done using css prop

example

const style = { link: css' color: inherit; ' } <NextLink href={href}><a href={href} css={style.link} {...rest}>{children}</a></NextLink>

Opted to use css prop as it is the most similar to previous format using makeStyles

Did anyone else noticed this metric to increase?

There is another similar issue at emotion’s git Emotion causes large Layout Shift (with critical CSS extraction) #2154 , but not completely the same, i don’t have any local font for example, i have google fonts which add only 0.0something to cls

I didn’t do any specific configuration or setup, it is and should work out of the box with nextjs and mui

Your Environment 🌎

Next.js, mui v5, emotion

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
haleybecommented, Jul 13, 2021

i agree, was wondering to see if there are more cases.

i will try to setup some example

1reaction
yulev5commented, Oct 31, 2022

I see the same problem in my website

Read more comments on GitHub >

github_iconTop Results From Across the Web

increase in Cumulative Layout Shift #27241 - mui/material-ui
Current Behavior. I notice significant increase in CLS after upgrading project from v4 to v5 and refactoring makeStyles/useStyles to emotion.
Read more >
Optimize Cumulative Layout Shift - web.dev
Cumulative Layout Shift (CLS) is a metric that quantifies how often users experience sudden shifts in page content.
Read more >
Improving Cumulative Layout Shift (CLS) Score for Kelley Blue ...
Layout shift related to styles is usually caused by a slight delay in loading and applying styles (so called “Flash of Unstyled Content”).To ......
Read more >
How to Fix Cumulative Layout Shift for Divi Websites (4.0 and ...
On August 18, 2021, Elegant Themes released a major performance update called Divi 4.10 (but not “5.0,” strictly speaking). It addresses most performance ......
Read more >
How To Fix Cumulative Layout Shift (CLS) Issues
Cumulative Layout Shift (CLS) attempts to measure those jarring movements of the page as new content — be it images, advertisements, or whatever ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found