Skip to content
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

[docs] Fix layout shift when streaming the page #35627

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Dec 25, 2022

The problem can be seen in:

Screen.Recording.2022-12-25.at.17.13.23.mov

There is this intermediary layout shift:

Screenshot 2022-12-25 at 17 19 50

It's detailed in depth in this blog post: https://twitter.com/jaffathecake/status/1149637428388360197 (from 8 years ago, but still true, and might be true forever).

Browsers can progressively render content as it's streamed from the server, this is great because it means users can start consuming content before it's all arrived. However, when combined with flexbox it causes misalignment and horizontal shifting.

I believe we are allowed to use CSS Grid https://caniuse.com/css-grid as it's compatible with our browser support.

Preview: https://deploy-preview-35627--material-ui.netlify.app/material-ui/react-autocomplete/

@oliviertassinari oliviertassinari added docs Improvements or additions to the documentation core Infrastructure work going on behind the scenes labels Dec 25, 2022
@mui-bot
Copy link

mui-bot commented Dec 25, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-35627--material-ui.netlify.app/

No bundle size changes

Generated by 🚫 dangerJS against 4d4896a

@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Dec 25, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 26, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 26, 2022
@oliviertassinari oliviertassinari merged commit 933e04b into mui:master Dec 30, 2022
@oliviertassinari oliviertassinari deleted the fix-layout-shift-streaming branch December 30, 2022 14:01
oliviertassinari added a commit that referenced this pull request Jan 2, 2023
@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jan 2, 2023

Oops, I broke the layout with this PR, e.g. https://deploy-preview-35627--material-ui.netlify.app/material-ui/react-table/. Fixed in 8e067ee.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work core Infrastructure work going on behind the scenes docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants