Skip to content

Cannot disable form submission using onSubmit handler #11522

@patsissons

Description

@patsissons

Do you want to request a feature or report a bug?
bug

What is the current behavior?
it is not currently possible to prevent form submission using the onSubmit handler

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
sample code at https://codesandbox.io/s/jpx80rj6vy

What is the expected behavior?
form should never submit because onSubmit returns false every time

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React 16

simplified code snippet below so you don't have to load the sandbox repro

<form onSubmit={() => false}>
  <input type="text" name="bar" placeholder="type and hit enter" />
</form>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions