[PR #5073] [CLOSED] fix: only scroll active sidebar items into view when not already visible #5286

Closed
opened 2026-06-05 15:20:51 -04:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Mintplex-Labs/anything-llm/pull/5073
Author: @angelplusultra
Created: 2/26/2026
Status: Closed

Base: masterHead: 4992-feat-preserve-scroll-position


📝 Commits (1)

  • e32f61f fix: only scroll active sidebar items into view when not already visible

📊 Changes

1 file changed (+32 additions, -2 deletions)

View changed files

📝 frontend/src/hooks/useScrollActiveItemIntoView.js (+32 -2)

📄 Description

Pull Request Type

  • feat (New feature)
  • 🐛 fix (Bug fix)
  • ♻️ refactor (Code refactoring without changing behavior)
  • 💄 style (UI style changes)
  • 🔨 chore (Build, CI, maintenance)
  • 📝 docs (Documentation updates)

Relevant Issues

resolves #4992

Description

Active sidebar items (workspace threads and settings menu options) would always scroll into center view on mount, causing jarring jumps even when the item was already visible in the scroll container.

This fix updates the useScrollActiveItemIntoView hook to check if the element is already fully visible within its nearest scrollable ancestor before calling scrollIntoView. It walks the DOM tree to find the actual scrollable parent (via scrollHeight > clientHeight) rather than matching by class name, making it work correctly across both the thread sidebar and settings sidebar (which has nested scroll containers).

Developer Validations

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Mintplex-Labs/anything-llm/pull/5073 **Author:** [@angelplusultra](https://github.com/angelplusultra) **Created:** 2/26/2026 **Status:** ❌ Closed **Base:** `master` ← **Head:** `4992-feat-preserve-scroll-position` --- ### 📝 Commits (1) - [`e32f61f`](https://github.com/Mintplex-Labs/anything-llm/commit/e32f61f017314c6a0c6b032f76dd89d2e3396c61) fix: only scroll active sidebar items into view when not already visible ### 📊 Changes **1 file changed** (+32 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/hooks/useScrollActiveItemIntoView.js` (+32 -2) </details> ### 📄 Description ### Pull Request Type - [ ] ✨ feat (New feature) - [x] 🐛 fix (Bug fix) - [ ] ♻️ refactor (Code refactoring without changing behavior) - [ ] 💄 style (UI style changes) - [ ] 🔨 chore (Build, CI, maintenance) - [ ] 📝 docs (Documentation updates) ### Relevant Issues resolves #4992 ### Description Active sidebar items (workspace threads and settings menu options) would always scroll into center view on mount, causing jarring jumps even when the item was already visible in the scroll container. This fix updates the `useScrollActiveItemIntoView` hook to check if the element is already fully visible within its nearest scrollable ancestor before calling `scrollIntoView`. It walks the DOM tree to find the actual scrollable parent (via `scrollHeight > clientHeight`) rather than matching by class name, making it work correctly across both the thread sidebar and settings sidebar (which has nested scroll containers). ### Developer Validations - [ ] I ran `yarn lint` from the root of the repo & committed changes - [ ] Relevant documentation has been updated (if applicable) - [ ] I have tested my code functionality - [ ] Docker build succeeds locally --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-06-05 15:20:51 -04:00
yindo closed this issue 2026-06-05 15:20:51 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#5286