-
Notifications
You must be signed in to change notification settings - Fork 597
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
FormControl.Label causing Layout Shift #2051
Comments
I'm also having this issue. simple reproduction CodeSandbox demo The issue occurs because the react/src/utils/create-slots.tsx Lines 25 to 30 in 03f3427
Only input component was rendered at the first render.
It might be hard to prevent Layout Shift but I hope at least all components can start render since the same render, instead of first render the input then render label or other stuff. I guess these solutions might work
Thanks to every contributors of this project, it is amazing! |
Hi! First of all, sorry @filipedeschamps, we missed your initial message! Thanks for reporting this. @EnixCoda is right, this is related to double rendered strategy for slots, we are tracking it here: #1690 |
I think this is likely solved by #2216; now both renders should happen before the first paint so there should be no visible flash. I don't see the problem on my end anymore. Please let us know if you do still see it! |
Describe the bug
FormControl.Label
is causing Layout Shift on page load (see gif below)To Reproduce
FormControl
with aFormControl.Label
component. For example:Expected behavior
<FormControl.Label>
should not flash on page load.Screenshots
Gif of the page being refreshed
Static image showing the exact frame where
<FormControl.Label>
is invisibleDesktop (please complete the following information):
Additional context
There's no logic applied to the
<FormControl.Label>
component. Here's the code from the gif above:Additional context (bonus)
I'm in love with Primer. It's been a long time since I've been this happy developing interfaces.
To everyone involved in this project: you are amazing 🤝
The text was updated successfully, but these errors were encountered: