I'm quite confused on the Link component. The docs state:
Defaults to true. The default scrolling behavior of <Link> in Next.js is to maintain scroll position [....]
So to me,scroll=truewill maintin scroll position, and thereforescroll=falsewont maintain position (i.e. it will go to the top). However, it then says:
When scroll = {false}, Next.js will not attempt to scroll to the first Page element.
which contradicts that idea, in which case, what doesscroll=falseeven do?
The reason I find it more confusing is because that's also not the behaviour I observed. When my links were scroll=true, scroll position would be maintained on the page (which is bad in my case due to dynamic content loading after the scroll, which screws up the position). However, when I set scroll=false, every time I navigated I would be taken to the top of the page, no exception.
Unfortunately, the client has reported the same scroll bug even when scroll=false, and after much experimenting I have narrowed it down to the fact that scroll=false doesn't quite scroll to the top of the page when the browser window is small, it is between a few tens to a few hundreds of pixels away from the top, which will then get messed up by the dynamic content.
Firstly, what does scroll=false even mean/do? And secondly, how do I force navigation to always scroll to the top? Do I just use window.scroll on in a client component in the root layout?