I am using the scrollRestoration
feature of Next.js to restore the page position when a back button is pressed. The problem, is that it doesn't restore the horizontal scroll position of the carousels on that page. So I have created my own session variables to track the position of each carousel and restore them on page load. The problem, is that I ONLY want to restore these scroll positions if the back/forward button was pressed. If there is an indicator that scrollRestoration
was used on the page I could use that, otherwise, if there is an indication that the page was visited using the forward/back buttons that would also solve it.
Any ideas?