Commit Graph

2 Commits

Author SHA1 Message Date
David Taylor d7bb8f68d6
DEV: Remove unused pageobject from scroll_manager_service_spec (#23501) 2023-09-11 10:28:25 +01:00
David Taylor dfe94ba118
DEV: Move all scroll position reset/remember logic to a shared service (#22552)
Previously we were implementing scroll reset/memorization on a per-page basis. Many of these approaches relied on the `didInsertElement` hook, which is no longer appropriate since Discourse changed to use the 'loading slider' strategy for page transitions.

This commit rips out all of our custom scroll resetting/memorizing, and implements those things in a generic service. There are two features:

1. After every route transition, scroll to the top of the page
2. When using browser back/forward buttons, restore the last known scroll position for those routes

To opt-out of the behaviour, individual routes can add a scrollOnTransition boolean to their RouteInfo metadata using Ember's `buildRouteInfoMetadata` hook.
2023-07-13 13:40:08 +01:00