phoenixframework / phoenix_live_reload

Provides live-reload functionality for Phoenix
MIT License
315 stars 90 forks source link

Feature: allow opt-in scroll restoration #145

Closed vanderhoop closed 6 months ago

vanderhoop commented 7 months ago

This pull request adds opt-in scroll restoration after full reloads, as proposed in #144, as this is helpful when working on components or content far below the fold.

chrismccord commented 6 months ago

v1.5 introduced major new features along with dispatching a phx:live_reload:attached function, which exposes a public LiveReloader instance. I think the best approach from here is allowing this instance to support a custom function for triggering a reload, and code in user-land could then store scroll state, trigger browser reload, restore scroll state. I would gladly review a PR that enables such an interface. Thanks!