Skip to content

Commit

Permalink
rjsf-team#3121 Fixed Programmatic submit not working properly in Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdallah Al-Soqatri committed Apr 2, 2024
1 parent 294b9e3 commit 7df7b87
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit 7df7b87

Please sign in to comment.