fix(layout): preserve sidebar scroll position across nav re-mount #199

Merged
vas2000-work merged 1 commit from fix/mapps-203-sidebar-scroll-preserve into main 2026-06-16 23:48:56 +02:00
Owner

Every page wraps its content in a fresh AppLayout, so each SPA navigation tears the sidebar down and re-mounts it. A re-mounted scroll container starts at scrollTop 0, which is the user-reported "sidebar scrolls all the way to the top on every click" symptom. The companion banner fix (version cache) only stopped the banner-collapse layout shift; the sidebar reset is a separate effect of the re-mount.

Hold the desktop sidebar nav's scroll offset in a signal owned by the App root (use_sidebar_scroll_provider), mirroring the existing collapse-state and version-cache providers that already outlive navigations. The persistent desktop sidebar records its offset on scroll and restores it on mount, so the nav stays put across clicks. The mobile drawer opts out (persist_scroll: false): it closes on every navigation, so it has no position worth keeping, and skipping the id keeps the two SidebarContent mounts from sharing a DOM id.

#MAPPS-203

Every page wraps its content in a fresh AppLayout, so each SPA navigation tears the sidebar down and re-mounts it. A re-mounted scroll container starts at scrollTop 0, which is the user-reported "sidebar scrolls all the way to the top on every click" symptom. The companion banner fix (version cache) only stopped the banner-collapse layout shift; the sidebar reset is a separate effect of the re-mount. Hold the desktop sidebar nav's scroll offset in a signal owned by the App root (use_sidebar_scroll_provider), mirroring the existing collapse-state and version-cache providers that already outlive navigations. The persistent desktop sidebar records its offset on scroll and restores it on mount, so the nav stays put across clicks. The mobile drawer opts out (persist_scroll: false): it closes on every navigation, so it has no position worth keeping, and skipping the id keeps the two SidebarContent mounts from sharing a DOM id. #MAPPS-203
fix(layout): preserve sidebar scroll position across nav re-mount
All checks were successful
Check / clippy + fmt + tests (pull_request) Successful in 1m52s
Create release / Create release from merged PR (pull_request) Has been skipped
8ea32b5dbc
Every page wraps its content in a fresh AppLayout, so each SPA navigation tears the sidebar down and re-mounts it. A re-mounted scroll container starts at scrollTop 0, which is the user-reported "sidebar scrolls all the way to the top on every click" symptom. The companion banner fix (version cache) only stopped the banner-collapse layout shift; the sidebar reset is a separate effect of the re-mount.

Hold the desktop sidebar nav's scroll offset in a signal owned by the App root (use_sidebar_scroll_provider), mirroring the existing collapse-state and version-cache providers that already outlive navigations. The persistent desktop sidebar records its offset on scroll and restores it on mount, so the nav stays put across clicks. The mobile drawer opts out (persist_scroll: false): it closes on every navigation, so it has no position worth keeping, and skipping the id keeps the two SidebarContent mounts from sharing a DOM id.

#MAPPS-203
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-apps!199
No description provided.