Skip to content

fix: scroll active sidebar items into view#4965

Merged
timothycarambat merged 5 commits intomasterfrom
4963-sidebar-selection-srcoll-into-view
Feb 7, 2026
Merged

fix: scroll active sidebar items into view#4965
timothycarambat merged 5 commits intomasterfrom
4963-sidebar-selection-srcoll-into-view

Conversation

@angelplusultra
Copy link
Contributor

@angelplusultra angelplusultra commented Feb 4, 2026

Pull Request Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #4963

What is in this change?

This PR fixes the sidebar selection scroll behavior so that active items are automatically scrolled into view when selected.

Changes:

  • Added a new reusable hook useScrollActiveItemIntoView that handles scrolling an element into the viewport when it becomes active
  • Applied the hook to MenuOption in the Settings Sidebar so the currently selected setting is scrolled to center view
  • Applied the hook to ThreadItem in the main Sidebar so the active thread is scrolled to center view
  • Uses behavior: "instant" to avoid visible scroll animation artifacts (since sidebars remount on navigation, smooth scrolling would animate from the top)

Additional Information

The instant behavior is used intentionally because the Settings Sidebar remounts on each page navigation. Using smooth would cause a visible scroll animation from the top of the sidebar to the active item every time you navigate.

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

Copy link
Collaborator

@shatfield4 shatfield4 left a comment

Choose a reason for hiding this comment

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

LGTM, we can reuse this hook in the future on the main chat sidebar to scroll into view the active workspace if a user has a lot of workspaces.

@timothycarambat timothycarambat merged commit 8f7e0fb into master Feb 7, 2026
1 check passed
@timothycarambat timothycarambat deleted the 4963-sidebar-selection-srcoll-into-view branch February 7, 2026 03:23
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.

[BUG]: Settings page left pane doesn't hold scrolling position

3 participants