I hate it when I click a link in a sidebar, then you loose your place. With Hotwire Turbo you can pretty easily persist the scroll position of an element between page loads.
In this tutorial I show you how to look into the Hotwire Turbo event cycle to persist scroll positions of elements on your page.
- Source Code: https://github.com/MikeRogers0-YouTube/Persist-Scroll-Position-Hotwire-Turbo
- Hotwired@Turbo: https://www.npmjs.com/package/@hotwired/turbo
- Turbo Event Reference: https://turbo.hotwire.dev/reference/events
- data-turbo-permanent Code: https://github.com/hotwired/turbo/blob/8bce5f17cd697716600d3b34836365ebcdc04b3f/src/core/snapshot.ts#L33
- Bridgetown: https://www.bridgetownrb.com/