final-form / final-form/react-final-form

Programmatic submit does not work in React 17

Open
#878 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.4k
Forks
497
PR merge metrics
No merged PRs in 30d

Description

# Are you submitting a **bug report** or a **feature request**?

Bug

### What is the current behavior?

Submission using `form.dispatchEvent(new Event('submit', { cancelable: true }))` does not work after upgrading to React 17.

Hit the
![image](https://user-images.githubusercontent.com/4565223/100552310-bf372200-3286-11eb-9ef7-8dbcc90b2914.png) button here to see it do nothing:

https://codesandbox.io/s/react-final-form-external-submit-button-forked-kcrsu?file=/index.js

### What is the expected behavior?

It submits the form, as it did prior to React 17. You can view this behavior by changing the React version in the sandbox.

### Sandbox Link

https://codesandbox.io/s/react-final-form-external-submit-button-forked-kcrsu?file=/index.js

### What's your environment?

RFF 6.5.2
FF 4.20.1
React 17

### Other information

Sandbox is an updated version from https://final-form.org/docs/react-final-form/faq#via-documentgetelementbyid. No other changes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.