Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Programmatic submit not working properly in Firefox(#3121). #4150

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ should change the heading of the (upcoming) version to include a major version b

-->

# 5.18.1

## @rjsf/core
- Fixed Programmatic submit not working properly in Firefox [#3121](https://github.com/rjsf-team/react-jsonschema-form/issues/3121)

# 5.18.0

## @rjsf/antd
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,11 @@ export default class Form<
/** Provides a function that can be used to programmatically submit the `Form` */
submit = () => {
if (this.formElement.current) {
this.formElement.current.dispatchEvent(
new CustomEvent('submit', {
cancelable: true,
})
);
const submitCustomEvent = new CustomEvent('submit', {
cancelable: true,
});
submitCustomEvent.preventDefault();
this.formElement.current.dispatchEvent(submitCustomEvent);
this.formElement.current.requestSubmit();
}
};
Expand Down