Skip to content

Commit

Permalink
Programmatic submit does not work in React 17 (#900)
Browse files Browse the repository at this point in the history
* Add bubbles:true to event

* Add bubbles:true to event
  • Loading branch information
mtoepfl authored Mar 20, 2021
1 parent b3c79b8 commit 2133eb6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ trigger React's event handlers.

<button onClick={() => {
document.getElementById('myForm')
.dispatchEvent(new Event('submit', { cancelable: true })) //
.dispatchEvent(new Event('submit', { cancelable: true, bubbles:true })) //
}}>Submit</button>

<form id="myForm" onSubmit={handleSubmit}>
Expand Down
2 changes: 1 addition & 1 deletion examples/external-submit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const App = () => {
// https://github.com/facebook/react/issues/12639#issuecomment-382519193
document
.getElementById('exampleForm')
.dispatchEvent(new Event('submit', { cancelable: true }))
.dispatchEvent(new Event('submit', { cancelable: true, bubbles:true }))
}
>
External Submit via <code>document.getElementById()</code>
Expand Down

0 comments on commit 2133eb6

Please sign in to comment.