fix(layout): preserve sidebar scroll position across nav re-mount #199
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/mapps-203-sidebar-scroll-preserve"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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