Skip to content

fix(docs): stop the sidebar drifting when page content resizes - #6301

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/docs-sidebar-sticky-drift
Aug 5, 2026
Merged

fix(docs): stop the sidebar drifting when page content resizes#6301
waleedlatif1 merged 2 commits into
stagingfrom
fix/docs-sidebar-sticky-drift

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • The docs sidebar visibly jumped whenever page content resized — expanding an FAQ row moved it 16.8px at a fixed scroll position, collapsing moved it back.
  • Root cause: the sidebar used fumadocs' sticky positioning, and a sticky box is bottom-limited by its containing block. #nd-docs-layout ends ~660px above the document bottom because the site footer is a sibling of the layout, not a grid child. So across the entire footer the sidebar was pushed progressively upward, and any content-height change while the reader was in that zone moved it.
  • Fix: pin the sidebar and its divider to the viewport. A fixed box ignores both the container's end and the document height, so neither the drift nor the jump can occur.

Why this is safe

  • The grid columns are explicit (0px 300px 1fr 268px 0px), so taking the placeholder out of flow leaves its track intact — the content column does not move.
  • left/width are restated because a fixed box no longer derives them from its grid cell; top/height still come from fumadocs' own utility classes.
  • The footer was already opaque (bg-[var(--bg)]) and now out-stacks the sidebar (z-20) and divider (z-21) at z-22, so it slides over them at the end of the page.
  • Desktop-only (min-width: 1024px) — mobile is untouched.

Testing

Measured with Playwright, before and after:

before after
sidebar shift on FAQ expand +16.8px 0px
sidebar shift on collapse −16.8px 0px
content column left / width unchanged (0 delta)
sidebar top at page bottom 75.2 → drifting 92px, held

Interaction regression suite, all passing: sidebar link navigates, sidebar folder expands, content link clickable (the naive position: fixed attempt broke this — a full-width fixed aside intercepted every click), FAQ toggles, ToC link clickable, language selector still hidden.

Verified top: 92px holds at the page bottom on the docs, API-reference, academy and integrations layouts, with zero page errors. Screenshots checked in light and dark at top/middle/bottom, plus mobile. Production build passes (4,281 static pages), typecheck and biome clean.

Type of Change

  • Bug fix

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

The sidebar used fumadocs' `sticky` positioning, and a sticky box is
bottom-limited by its containing block. #nd-docs-layout ends ~660px above the
document bottom because the site footer is a sibling of the layout rather than
a grid child, so across the whole footer the sidebar was pushed progressively
upward. Any content-height change while the reader sat in that zone then moved
it: expanding one FAQ row shifted the sidebar 16.8px at a fixed scroll offset,
and collapsing it shifted it back.

Pin the sidebar and its divider to the viewport instead. A fixed box ignores
both the container's end and the document height, so neither the drift nor the
jump can happen. The grid columns are explicit (`0px 300px 1fr 268px 0px`), so
taking the placeholder out of flow leaves its track intact and the content
column does not move. The footer is already opaque and now out-stacks both, so
it slides over them at the end of the page.

Measured with Playwright before and after: sidebar delta on expand/collapse
16.8px/-16.8px -> 0px/0px, content column left and width unchanged, and the
sidebar holds top:92px at the page bottom on the docs, API-reference, academy
and integrations layouts. Mobile is untouched (the rule is desktop-only).
@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview Aug 5, 2026 11:27pm

Request Review

@cursor

cursor Bot commented Aug 5, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Desktop-only CSS layout and stacking changes in the docs app; no auth, data, or API logic touched.

Overview
Fixes a visible sidebar jump on the docs site when page height changes (e.g. expanding an FAQ) while the reader is near the footer. Fumadocs’ sticky sidebar was bounded by #nd-docs-layout, which ends above the site footer, so the sidebar drifted upward over the footer zone and shifted on content resize.

On desktop (min-width: 1024px), [data-sidebar-placeholder] and the #nd-docs-layout::before divider are position: fixed with explicit left/width (and the divider’s existing top/height), so they stay pinned to the viewport instead of the layout box. Grid column tracks stay explicit, so the main column layout is unchanged.

The footer gets relative z-[22] so it stacks above the sidebar (z-20) and divider (z-21) and covers them at the bottom of the page rather than showing through.

Reviewed by Cursor Bugbot for commit 94d9235. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR pins the desktop docs sidebar and divider to the viewport to prevent content-resize drift, while moving footer stacking onto the footer component.

  • Fixes the sidebar placeholder and divider at desktop widths.
  • Places the site footer above the fixed sidebar and divider.
  • Removes obsolete grid placement from the fixed divider.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/docs/app/global.css Pins the desktop sidebar and divider to viewport-derived positions and removes grid declarations made inert by fixed positioning.
apps/docs/components/footer/footer.tsx Adds a documented stacking level so the footer paints over the fixed sidebar and divider.

Reviews (2): Last reviewed commit: "refactor(docs): drop dead grid placement..." | Re-trigger Greptile

Comment thread apps/docs/app/global.css
Comment thread apps/docs/app/global.css Outdated
… component

Review follow-ups. The divider's `grid-row`/`grid-column` stopped doing anything
the moment it became `position: fixed` — a fixed box is out of grid layout
entirely — so they and the comment explaining the grid span were describing
positioning that no longer happens. Verified inert: the divider still computes
to left 300px / width 1px / z-index 21 without them.

The footer's stacking context also belongs on the footer, not in a global rule
matching every desktop `footer` element, so it moves to the component as
`relative z-[22]` with the reason in its TSDoc.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 94d9235. Configure here.

@waleedlatif1
waleedlatif1 merged commit a7d6b96 into staging Aug 5, 2026
23 of 24 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/docs-sidebar-sticky-drift branch August 5, 2026 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant