Disable scrolling to the top of the page when Intercepting Routes - Modal #48445
Replies: 9 comments 14 replies
-
any update on this? |
Beta Was this translation helpful? Give feedback.
-
Mine scroll to the bottom... |
Beta Was this translation helpful? Give feedback.
-
If you're using <Link> from next/link to navigate to the intercepted route, you can add scroll={false} attribute to it and this would be fixed. |
Beta Was this translation helpful? Give feedback.
-
Hello! I see that this behavior is still happening, when navigating among sections of a page. It is because we use #, putting into the href links (we must define IDs to every Is there a way that Nextjs can solve this use case? Thank you! |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
-
Good if |
Beta Was this translation helpful? Give feedback.
-
In my case the intercepted page was automatically scrolling to bottom, and my problem was that I was declaring the {modal} child at the end, under the {children}. I solved it by placing the modal on top. |
Beta Was this translation helpful? Give feedback.
-
any update? |
Beta Was this translation helpful? Give feedback.
-
I managed to prevent the scroll-to-top behavior when using |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When utilizing the Intercepting Routes feature to create modals, the page scrolls to the top, which is bad to usability.
For instance, consider a masonry grid with photos, similar to Instagram's explore page or Pinterest. When a user clicks on a photo, a modal opens with shareable content via a URL, while the page's scroll position remains unchanged.
However, when using Next.js 13, as demonstrated in the nextgram by the Vercel Team, which employs the new "Parallel Routes and Intercepting Routes" features, if a user scrolls to the last photo and clicks on it, the scroll position resets, negatively impacting the user experience.
Background
As a result, I'm missing a "scroll={false}" option, which could be used in previous Next.js versions."
Proposal
We should able to Disable scrolling to the top of the page
Beta Was this translation helpful? Give feedback.
All reactions