I have a form in a Modal which is submitted by a button outside the form. I am using useRef to create a reference of the form and then submitting it on button click.
const formRef = useRef(null);
const form = (
<Form onSubmit={onSave} ref={formRef}>
.
.
.
</Form>
)
<CustomModal
body={form}
onPrimaryClick={() => {
formRef.current.requestSubmit();
}}
/>
This code works perfectly on Chrome and Firefox but throws a TypeError on Safari I.current.requestSubmit is not a function

I am not sure what I am doing wrong here and why the code works in other browsers.