mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-21 06:11:45 +00:00
047b334ca4
Both DayPlanSidebar and PlacesSidebar have their own internal scroll containers (overflowY: auto). Scroll events don't bubble, so previous attempts that tracked scrollTop on the outer portal div never fired. Each sidebar now accepts initialScrollTop and onScrollTopChange props. The internal scroll container saves its scrollTop via onScrollTopChange on every scroll event, and restores it via useLayoutEffect on mount (before the browser paints, so no visible flash). TripPlannerPage holds the saved values in refs (mobilePlanScrollTopRef, mobilePlacesScrollTopRef) and passes them through on each portal mount.