-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useFetcher().Form
always scrolls to the top on submit, Form
doesn't
#4265
Comments
Same for me, I created a repo similar to @itsMapleLeaf before I found this issue. I expanded on it a bit more submitting with either Form, useSubmit, fetcher.Form and fetcher.submit and returning either json or redirect from the action. What version of Remix are you using?1.7.6 Steps to Reproducegit clone https://github.com/emilbryggare/remix-fetcher-scrolls-to-top-2 Expected BehaviorThe fetcher.form and fetcher.submit shouldn't scroll to the top. Ideally, the behavior should be configurable Actual BehaviorThe fetcher.form and fetcher.submit scrolls to the top |
@itsMapleLeaf Thank you for opening this issue 🍁 @emilbryggare Can you try again with #3165 applied and see if everything works as expected? 🙏🏼 |
@machour Sure! After applying the patch (in version 1.7.6), all scenarios in my reproduction worked as expected. 👍 |
By default scroll position will be reset on action submissions if the submission redirects, since it's sending you to a "new" location. You can disable this via the Related: remix-run/react-router#9886 |
What version of Remix are you using?
1.7.2
Steps to Reproduce
git clone https://github.com/itsMapleLeaf/remix-fetcher-scrolls-to-top cd remix-fetcher-scrolls-to-top pnpm install pnpm dev
Scroll down a bit, and see the difference in behavior between
<Form>
and the fetcher formExpected Behavior
The fetcher form shouldn't scroll to the top. Ideally, the behavior should be configurable
Actual Behavior
The fetcher form scrolls to the top
The text was updated successfully, but these errors were encountered: