Skip to content

fix: Sidebar scroll position jumping on navigation#16416

Merged
stephanie-anderson merged 1 commit intomasterfrom
fix/sidebar-scroll-persistence
Feb 17, 2026
Merged

fix: Sidebar scroll position jumping on navigation#16416
stephanie-anderson merged 1 commit intomasterfrom
fix/sidebar-scroll-persistence

Conversation

@stephanie-anderson
Copy link
Contributor

@stephanie-anderson stephanie-anderson commented Feb 17, 2026

Fix sidebar scroll position not being preserved when navigating between pages. Particularly noticeable on smaller screens (e.g. MacBook Pro 14") when navigating within a section like /development-infrastructure/.

Three bugs fixed:

  • Missing ScrollActiveLink in develop-docs sidebar — the product sidebar had scroll persistence but the develop-docs sidebar did not
  • Click handler never fired — used target.hasAttribute('data-sidebar-link') but click targets are always child <span>/<div> elements inside the link; fixed to use target.closest()
  • Fragile scroll restoration — replaced getBoundingClientRect math with direct scrollContainer.scrollTop save/restore, and removed a scroll handler that was overwriting click data with stale positions

Co-Authored-By: Claude noreply@anthropic.com

The sidebar scroll position was not preserved when navigating between
pages, especially in the develop-docs sidebar. Three issues fixed:

1. Add missing ScrollActiveLink to DevelopDocsSidebar (was only in
   product sidebar)
2. Fix click handler using hasAttribute instead of closest(), which
   never fired because click targets are child elements inside the link
3. Store scrollContainer.scrollTop directly instead of fragile
   getBoundingClientRect math, and remove scroll handler that was
   overwriting click data with stale active link positions

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 17, 2026

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

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Feb 17, 2026 6:40pm
sentry-docs Ready Ready Preview, Comment Feb 17, 2026 6:40pm

Request Review

Copy link
Contributor

@coolguyzone coolguyzone left a comment

Choose a reason for hiding this comment

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

Changes look good, behavior looks good on preview, seeing expected changes in sessionStorage.

@stephanie-anderson stephanie-anderson merged commit 21f5d01 into master Feb 17, 2026
17 checks passed
@stephanie-anderson stephanie-anderson deleted the fix/sidebar-scroll-persistence branch February 17, 2026 19:40
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.

2 participants