inertiajs / inertia

Inertia.js lets you quickly build modern single-page React, Vue and Svelte apps using classic server-side routing and controllers.
https://inertiajs.com
MIT License
6.3k stars 423 forks source link

[1.x] Fix [scroll-region] on html element with overflow-scroll #1782

Closed axel-paillaud closed 2 weeks ago

axel-paillaud commented 8 months ago

add restoreScrollPositions() in setPage() method if we have scroll-region. Use this.page instead of page.

This is related to #1211

In line 454 : console.log(page.scrollRegions) is always undefined, and I don't know why. If we do only console.log(page), we can see the scrollRegions field inside browser inspector, but I think it was populated asynchronously ?

With this version, scroll-region work well, and scrolling items are not reset when we submit the form (for example), but this.page is kind of a cheat ?

axel-paillaud commented 2 weeks ago

You're welcome ! Glad to help. Let me know if I should reinvestigate this PR, I admit that since it's been a while, I would have to dive back into it, but it's possible if you think it's necessary.