Skip to content

sveltejs/[email protected] throws on formSubmit #5850

@bipedal-eel

Description

@bipedal-eel

What is affected?

Component, Accessibility

Description

The following svelte/kit code

<form method="get" action="/api">
  <md-filled-button type="submit">Submit</md-filled-button>
</form>

throws an error: Uncaught TypeError: Failed to construct 'FormData': The specified element is not a submit button.

This diff is "responsible", the issue is that the controller/formSubmitter adds the md-button as the submitter

Reproduction

<form method="get" action="/api">
  <md-filled-button type="submit">Submit</md-filled-button>
</form>

StackBlitz

Workaround

<md-filled-button type="submit" onclick="{(e) => { e.preventDefault(); e.target.form.requestSubmit(); }}">Submit</md-filled-button>

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

2.4.0

Browser/OS/Node environment

Browser: Firefox/143.0
Os: Widows 11
Node version: v22.13.1
Npm version: 10.9.2

should be a general issue on every Browser/version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions