Skip to content

<Form> submitter is serialized out of tree order #4342

@jenseng

Description

@jenseng

What version of Remix are you using?

1.7.2

Steps to Reproduce

  1. Make a <Form> like so:
<Form>
  <button type="submit" name="foo" value="override">Override</button>
  <input type="hidden" name="foo" value="default" />
</Form>
  1. Click the "Override" button

Expected Behavior

The form fields should be serialized in tree order, i.e. foo=override&foo=default (as is the case with a vanilla <form>).

See Constructing the form data set in the HTML spec. Submitted fields should be sent in the order they appear in the DOM, including the submitter (i.e. the submit button that was clicked).

Actual Behavior

The form is serialized as foo=default&foo=override.

This is problematic on the server-side if you are relying on the order to indicate precedence. formData.get("foo") will yield different values, depending on whether the form was submitted by Remix or native browser behavior.

See also #3611; prior to that fix it was broken in a different way (it would only serialize foo=default)

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