react icon indicating copy to clipboard operation
react copied to clipboard

Bug: formMethod specified on the submit button doesn't override the method from useFormStatus.

Open levkovich2806 opened this issue 7 months ago • 7 comments

React version: 19.1

When using formMethod on a submit button (<button type="submit" formMethod={"post"}> or <input type="submit" formMethod={"post"}>), it should override the parent form's method. However, it does not.

Steps To Reproduce

  1. Open example (link below)
  2. Click to any "Submit button"
  3. under the text input field will "method" will be shown.

Link to code example:

https://codesandbox.io/p/sandbox/react-dev-forked-ks99yw

The current behavior

Displayed method: dialog

The expected behavior

Displayed method: post

levkovich2806 avatar May 27 '25 21:05 levkovich2806

I’d like to take this on. Please let me know if there’s anything I should be aware of before I begin.

developerjhp avatar May 31 '25 01:05 developerjhp

But it works if add formAction - maybe that's the catch?

levkovich2806 avatar Jun 03 '25 06:06 levkovich2806

@levkovich2806

You're absolutely right to bring this up — it’s a subtle but important distinction.

According to the HTML specification, the formmethod attribute on a submit button should override the form’s method, regardless of whether formaction is present.

"If specified, this attribute overrides the method attribute of the form element that owns this control."

So while adding formAction may appear to "fix" the issue in some browsers or setups, React should still respect formMethod even when formAction is omitted — to match the spec and native form behavior.

developerjhp avatar Jun 03 '25 23:06 developerjhp

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

github-actions[bot] avatar Sep 02 '25 00:09 github-actions[bot]

bump

levkovich2806 avatar Sep 02 '25 09:09 levkovich2806

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

github-actions[bot] avatar Dec 01 '25 17:12 github-actions[bot]

bump

jenseng avatar Dec 02 '25 03:12 jenseng