-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
fix(v2): Fix announcementBar layout shifts #5040
Conversation
✔️ [V2] 🔨 Explore the source changes: 70059ab 🔍 Inspect the deploy log: https://app.netlify.com/sites/docusaurus-2/deploys/60d34b8e6fb6790008af804d 😎 Browse the preview: https://deploy-preview-5040--docusaurus-2.netlify.app |
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-5040--docusaurus-2.netlify.app/ |
Size Change: +1.96 kB (0%) Total Size: 571 kB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job! 👏
It also decides bug with height adjustment of sidebar menu. Apparently this regression after #4617 (just now noticed it). |
Thanks
What do you mean by "decides bug"? is this fixed? |
Yes, this PR fixes that bug. |
great news then :) thanks |
Motivation
Docusaurus announcement bar is appearing only after React hydration
It triggers a layout shift, which is a bad signal for SEO / Google / Core Web Vitals (cumulative layout shift metric)
Instead we can render the announcement bar on the server, and hide it immediately with inlined js if it has been dismissed
This removes completely the layout shift issue in core web vitals extension:
Have you read the Contributing Guidelines on pull requests?
yes
Test Plan
preview