diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b3f674238..c77d4c980f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/core/src/components/Form.tsx b/packages/core/src/components/Form.tsx index 31752c41e0..9addaf8c0e 100644 --- a/packages/core/src/components/Form.tsx +++ b/packages/core/src/components/Form.tsx @@ -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(); } };