diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af8eb6..f34a42f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- instant scrolling to top on active `PanelSideBarItem`; scrolling smoothing to center instead. + ## [5.3.0] - 2025-09-30 ### Fix diff --git a/src/lib/Layout/PanelSideBarLayout/PanelSideBar/PanelSideBarItem.tsx b/src/lib/Layout/PanelSideBarLayout/PanelSideBar/PanelSideBarItem.tsx index d6593f3..43f9d14 100644 --- a/src/lib/Layout/PanelSideBarLayout/PanelSideBar/PanelSideBarItem.tsx +++ b/src/lib/Layout/PanelSideBarLayout/PanelSideBar/PanelSideBarItem.tsx @@ -50,10 +50,14 @@ const PanelSideBarItem = (props: PanelS const collapsedWithIcon = isIconShownOnSidebarCollapse && !isSidebarOpen; useEffect(() => { - if (scrollToActiveItemRef.current && isActive) { - scrollToActiveItemRef.current.scrollIntoView(); + const currentItem = scrollToActiveItemRef.current; + + if (!item.active || !currentItem) { + return; } - }, [isActive]); + + currentItem.scrollIntoView({ behavior: "smooth", block: "center" }); + }, [scrollToActiveItemRef, item.active]); return ( <>