Skip to content

Commit

Permalink
#3121 Fixed Programmatic submit not working properly in Firefox (#4150)
Browse files Browse the repository at this point in the history
Co-authored-by: Abdallah Al-Soqatri <abdallah.al-soqatri@aspentech.com>
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 5, 2024
1 parent 3e784ff commit b705399
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 b705399

Please sign in to comment.