scroll restoration without scroll animation #3510
Replies: 3 comments 2 replies
-
react-query does nothing for scroll restoration - it's the browser doing it. https://developer.mozilla.org/en-US/docs/Web/API/History/scrollRestoration |
Beta Was this translation helpful? Give feedback.
-
Right. And I read another reply in which you mentioned this. Yet this page https://react-query.tanstack.com/guides/scroll-restoration made me think it's react-query that's adding scroll restoration. I know this question is no longer related to RQ, but please help me understand this while we're at it. Is the scroll restoration with animation a default behavior of Chrome? I don't believe I have explicitly enabled scroll restoration anywhere in my react app. So my guess is that it must be one of the libraries that I'm using. I suspected it was RQ because of the above documentation. I don't think even React Router is adding it. |
Beta Was this translation helpful? Give feedback.
-
That's interesting. I will continue to investigate where it got added.
Really appreciate your answers. Thanks Dominik!
…On Thu, Apr 14, 2022 at 11:37 PM Dominik Dorfmeister < ***@***.***> wrote:
i can actually not get scroll restoration to work in any of our examples.
maybe its a codesandbox thing, but I always stay at the top of the page :/
—
Reply to this email directly, view it on GitHub
<#3510 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUGSRI7H43ZSMCLHS7MGXTVFEFDFANCNFSM5TPVKC4A>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
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.
-
I'm wondering if there is a way to disable the scroll animation with scroll restoration?
For example, if I have a long list of posts. I scroll down to one of the posts and click on it. Later when I navigate using back button, the position is restored to the post that I clicked. But it does so by scrolling automatically all the way down to this post. What I'm expecting is something equivalent of
where upon navigating back, the page is already positioned at the right offset without the scroll effect.
Is this possible?
Beta Was this translation helpful? Give feedback.
All reactions