Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
fix(docs): prevent layout shift when search modal opens
Richie McIlroy680470ca1068
diff --git a/apps/web/app/(docs)/docs/_components/DocsHeader.tsx b/apps/web/app/(docs)/docs/_components/DocsHeader.tsxindex 0d33b3bc3..0cdac1085 100644--- a/apps/web/app/(docs)/docs/_components/DocsHeader.tsx+++ b/apps/web/app/(docs)/docs/_components/DocsHeader.tsx@@ -38,7 +38,12 @@ export function DocsHeader() {}, []);return (- <header className="fixed top-0 left-0 right-0 z-50 flex items-center justify-between h-14 px-4 bg-white border-b border-gray-200">+ <header+ className="fixed top-0 left-0 right-0 z-50 flex items-center justify-between h-14 px-4 bg-white border-b border-gray-200"+ style={{+ paddingRight: "calc(1rem + var(--scrollbar-compensation, 0px))",+ }}+ ><div className="flex items-center gap-3"><buttontype="button"diff --git a/apps/web/app/(docs)/docs/_components/DocsSearch.tsx b/apps/web/app/(docs)/docs/_components/DocsSearch.tsxindex 56eed6368..77e7b18ab 100644--- a/apps/web/app/(docs)/docs/_components/DocsSearch.tsx+++ b/apps/web/app/(docs)/docs/_components/DocsSearch.tsx@@ -167,12 +167,23 @@ export function DocsSearch({ searchIndex }: DocsSearchProps) {useEffect(() => {if (isOpen) {+ const scrollbarWidth =+ window.innerWidth - document.documentElement.clientWidth;+ document.documentElement.style.setProperty(+ "--scrollbar-compensation",+ `${scrollbarWidth}px`,+ );+ document.body.style.paddingRight = `${scrollbarWidth}px`;document.body.style.overflow = "hidden";} else {document.body.style.overflow = "";+ document.body.style.paddingRight = "";+ document.documentElement.style.removeProperty("--scrollbar-compensation");}return () => {document.body.style.overflow = "";+ document.body.style.paddingRight = "";+ document.documentElement.style.removeProperty("--scrollbar-compensation");};}, [isOpen]);@@ -210,6 +221,7 @@ export function DocsSearch({ searchIndex }: DocsSearchProps) {value={query}onChange={(e) => setQuery(e.target.value)}placeholder="Search documentation..."+ autoFocusclassName="flex-1 h-14 text-base text-gray-900 placeholder-gray-400 outline-none bg-transparent"aria-label="Search documentation"aria-autocomplete="list"