material-components / material-components/material-web

sveltejs/kit@2.43.3 throws on formSubmit

Open
#5,850 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
11.3k
Forks
1.1k
Avg merge
20h 28m
Merged PRs (30d)
13

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and inspect internal/controller/form-submitter.ts, especially the controller behavior identified in the report. Compare the SvelteKit formSubmit behavior with the md-filled-button submitter interaction. Done means the provided form can submit without the reported FormData TypeError in the affected browser scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.