Skip to content
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

Form post to any url if on page url with fragment doesn't work #9943

Closed
SleeplessByte opened this issue Jan 12, 2023 · 5 comments · Fixed by #9944
Closed

Form post to any url if on page url with fragment doesn't work #9943

SleeplessByte opened this issue Jan 12, 2023 · 5 comments · Fixed by #9944
Labels

Comments

@SleeplessByte
Copy link

SleeplessByte commented Jan 12, 2023

What version of Remix are you using?

7.30.0

Steps to Reproduce

Be on a page with a fragment like /my-page#content

Now add a form:

<Form method="post">
	<button type="submit">Go for it</button>
</Form>

Now press the button. It will go to /my-page by removing the fragment, without posting the form.
It doesn't matter if an explicit action is present:

<Form method="post" action="/my-page">
	<button type="submit">Go for it</button>
</Form>

Expected Behavior

It ignores fragments / anchors because they should be ignored when doing a form post.

Actual Behavior

With JavaScript: It scrolls the page to the top of the page without posting.
Without JavaScript: It works as expected.

@liegeandlief
Copy link

Can confirm I am also seeing this issue. It previously worked such that submitting a Form to the same URL when the URL contains a fragment would run the action as expected. Now the action is not run and all that seems to happen is that the fragment gets removed from the URL.

@SleeplessByte SleeplessByte changed the title Form post on url with fragment to same page doesn't work Form post to any url if on page url with fragment doesn't work Jan 19, 2023
@brophdawg11
Copy link
Contributor

This looks like a bug - we short circuit navigations on hash change only since they are just intended to scroll the client side pages, but that is incorrectly triggering even when there is a submission.

@brophdawg11
Copy link
Contributor

This is a bug in the @remix-run/router so I'm going to transfer it over to the react-router repo

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 6.7.1-pre.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@brophdawg11 brophdawg11 added the awaiting release This issue have been fixed and will be released soon label Jan 24, 2023
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 6.8.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@brophdawg11 brophdawg11 removed the awaiting release This issue have been fixed and will be released soon label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants