-
Notifications
You must be signed in to change notification settings - Fork 534
Description
Version:
@inertiajs/reactversion: 1.2.0
Describe the problem:
I have a div with a scrollable list: every element in that list is a button. Clicking the button trigger a get request to the server and the serve (for simplicity) redirect back to the view.
I want the scroll position in the div to be preserved after the redirect back, but instead it's always reset to the top of the page.
Steps to reproduce:
method
const submit = async () => {
router.get('/account/notification/' + notification.id , { preserveScroll: false })
}component
<main className="h-dvh overflow-y-hidden">
<div scroll-region={"true"} className="overflow-y-auto">
<button onClick={submit}>Notification</button>
{/* ...a very looong list*/}
</div>
</main>route
public function notification_mark($id)
{
/* various operations */
return to_route('account.notifications');
}Doesn't matter what I put in the preserveScroll parameter, every time scroll position get restored to the top of the page, while I would love the it stays where I clicked first.
I already tried with the form helper, with the Link component, nothing works.
Also, doing as per the documentation
<div class="overflow-y-auto" scroll-region>
<!-- Your page content -->
</div>produce a warning:
Warning: Received `true` for a non-boolean attribute `scroll-region`.
Removing the "overflow-y-auto" and letting the page go for itself do the tricks.. but it's not what I want and what is menta to be.
Any help would be VERY appreciated.
Thanks!