Skip to content

Tighten up form transport stuff #16321

Description

@Rich-Harris

Describe the problem

It's a bug that you can manually specify the name of a remote form input:

<form {...myform}>
  <!-- good -->
  <input {...myform.fields.message.as('text')} />

  <!-- bad -->
  <input name="message" />

  <button>submit</button>
</form>

It's bad because it defeats type safety, and because it allows you to accidentally use a field from the wrong form, and because people will come to do weird shit that will break if we're forced to change some detail of the implementation at a later date.

Describe the proposed solution

Enforce the correct use of remote form fields by prefixing the name with an identifier, so that this...

<input {...myform.fields.message.as('text')} />

...renders as something like this:

<input type="text" name="xyz123/myform/s/message" value="..." aria-invalid="..." />

(I don't think we should include the id of a .for(...) in the prefix, that would be annoying.)

Alternatives considered

No response

Importance

nice to have

Additional Information

No response

Activity

  1. added this to the 3.0 milestone on Jul 10, 2026
  2. ottomated commented on Jul 11, 2026

    @ottomated
    Contributor

    I can take this one!

  3. added a commit that references this issue on Jul 23, 2026
    7390dbe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions