Skip to content

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

@SleeplessByte

Description

@SleeplessByte

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions