From 7cb3caf15830956348fc96e5f8c9f66972b792d9 Mon Sep 17 00:00:00 2001 From: opentabs-dev <260357279+opentabs-dev@users.noreply.github.com> Date: Sat, 21 Feb 2026 10:19:15 -0800 Subject: [PATCH] fix: prevent sidebar jitter, scroll passthrough, and nav z-index overlap Three related bugs fixed: 1. Sidebar jitter on scroll sticky + self-start in a flex container causes 1-2px drift each frame as the browser recalculates position. Fixed by making the sidebar fixed so it is composited independently of page scroll. left tracks the max-w-7xl centered container via max(0px, (100vw - 80rem) / 2). 2. Scroll passthrough on sidebar and TOC overflow-y-auto only intercepts wheel events when content overflows. Hovering over gaps between items or on a short sidebar sends scroll to the page instead. Fixed with overflow-y-scroll (always a scroll container) and overscroll-y-contain (no chaining at boundaries). sidebar-scroll already hides the forced scrollbar track visually. 3. TopNav z-index too low (z-1) Page content with higher z-index (copy buttons, etc.) rendered over the sticky nav while scrolling. Fixed by raising nav to z-50. Files changed: - app/(docs)/docs/layout.tsx - components/SideNav.tsx - components/TableOfContents.tsx - components/TopNav.tsx --- app/(docs)/docs/layout.tsx | 20 +++++++++++--------- components/SideNav.tsx | 4 ++-- components/TableOfContents.tsx | 2 +- components/TopNav.tsx | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/app/(docs)/docs/layout.tsx b/app/(docs)/docs/layout.tsx index 6696c78..b6ee836 100644 --- a/app/(docs)/docs/layout.tsx +++ b/app/(docs)/docs/layout.tsx @@ -11,15 +11,17 @@ export default function ComponentLayout({ children: React.ReactNode; }>) { return ( -
-
-
- {/* Sidebar */} -
- -
- {children} -
+
+ {/* Sidebar — fixed to the viewport, left-aligned with the max-w-7xl (80rem) + centered container. On screens narrower than 80rem, left is 0. */} +
+ +
+ + {/* Content area — pl-80 reserves space for the fixed sidebar (w-60) + gap (20). + No independent centering: the parent max-w-7xl is the single source of truth. */} +
+ {children}
); diff --git a/components/SideNav.tsx b/components/SideNav.tsx index 233a243..668412c 100644 --- a/components/SideNav.tsx +++ b/components/SideNav.tsx @@ -13,9 +13,9 @@ export default function SideNav({ setIsOpen }: SideNavProps) { const pathname = usePathname(); return ( -
+