From ff2f9ed97e66ab90679865800138ba4d13d82d45 Mon Sep 17 00:00:00 2001 From: FredrikOseberg Date: Thu, 14 Aug 2025 13:45:12 +0200 Subject: [PATCH] fix: cls --- website/src/css/critical.css | 13 +++++++++++++ website/src/css/custom.css | 12 ++++++++++++ website/src/theme/Root.tsx | 6 ------ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/website/src/css/critical.css b/website/src/css/critical.css index 0061b3ae9a..cb9117f0f4 100644 --- a/website/src/css/critical.css +++ b/website/src/css/critical.css @@ -30,6 +30,19 @@ html, body { .navbar .navbar__brand { display: none; } + + /* Reserve space for GitHub star button to prevent shift */ + .header-github-link.navbar-link-outlined { + min-width: 120px; /* Reserve space for "Star 12.5k" */ + display: inline-flex; + align-items: center; + justify-content: center; + } + + /* Ensure navbar items don't shift */ + .navbar__items--right { + min-width: 450px; /* Stabilize right navbar width */ + } } /* Minimal layout structure to prevent major shifts */ diff --git a/website/src/css/custom.css b/website/src/css/custom.css index 65b9f637a6..37851cfea7 100644 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -144,6 +144,18 @@ html[data-theme="dark"] { padding-right: 6px; border: 1px solid var(--ifm-navbar-link-color); border-radius: 4px; + /* Prevent layout shift by reserving space */ + min-width: 120px; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 4px; +} + +/* Ensure the star count doesn't cause reflow */ +.navbar-link-outlined strong { + min-width: 45px; + text-align: left; } .header-github-link.navbar-link-outlined:hover { diff --git a/website/src/theme/Root.tsx b/website/src/theme/Root.tsx index 112301afbb..cdd0b6a66c 100644 --- a/website/src/theme/Root.tsx +++ b/website/src/theme/Root.tsx @@ -132,12 +132,6 @@ export default function Root({ children }: { children: React.ReactNode }) { passive: true, }); - // Fallback: load analytics after 10 seconds if no interaction - const fallbackTimer = setTimeout(() => { - loadGoogleAnalytics(); - loadGoogleTagManager(); - }, 10000); - return () => { clearTimeout(fallbackTimer); window.removeEventListener('scroll', handleUserInteraction);