Next.js Discord

Discord Forum

no scroll to top when changing page

Unanswered
piscopancer posted this in #help-forum
Open in Discord
when I click a Link component which brings me to another page, I keep the scroll progress. In results into the article page being scrolled to the middle when the article was selected from the blog page which was scrolled far enough. Ah, can I make Links nullify the scroll?

13 Replies

It's a known bug... Usually you would control that behaviour with the scroll prop, but it doesn't respect it at times.
hm
@not-milo.tsx neither scroll false or scroll true are working
that's sad
should I do it programmatically?
that's crazy
@piscopancer that's sad
Yeah, I know... Hopefully it'll get fixed soon
clear...
😦
Gulf menhaden
any updates on this?
Gulf menhaden
Oooh, so adding an empty element before the sticky navbar at the top fixes the issue. Now I want to know why :thinq:
Gulf menhaden
Here is the error on my end, I did not check the warning in browser console log while debugging it.

layout-router.js:114  Skipping auto-scroll behavior due to `position: sticky` or `position: fixed` on element: 


and this was my layout.tsx before
  <div className='min-h-screen w-full'>
      <BrowseNavBar />
      <div className='py-[5.625rem] md:py-[7.1875rem]'>{children}</div>
    </div>