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

dispatchEvent submit does not work in ie11 #1431

Closed
3 tasks done
martsie opened this issue Aug 23, 2019 · 5 comments · Fixed by #1432
Closed
3 tasks done

dispatchEvent submit does not work in ie11 #1431

martsie opened this issue Aug 23, 2019 · 5 comments · Fixed by #1432

Comments

@martsie
Copy link

martsie commented Aug 23, 2019

Prerequisites

Description

In Internet Explorer when attempting to submit the form, the following error occurs:

image

Steps to Reproduce

Submit a form.

Expected behavior

The form to submit.

Actual behavior

Error in ie11.

Version

Latest

I'll probably have to come up with a way of polyfilling the Event on the form but I'm wondering why dispatchEvent was chosen in the first place over calling .submit directly on the form element?

@epicfaace
Copy link
Member

epicfaace commented Aug 23, 2019

Not sure, it seems to have been added in by @sunweiye in #1058.

If we can just call .submit directly and not lose any functionality, then I'm all for it.

@martsie
Copy link
Author

martsie commented Aug 23, 2019

I'm having a deeper look now - looks like Internet Explorer 11 doesn't support creating Event's ... I'll get back to this issue once (if) I've got a neat solution.

martsie pushed a commit to martsie/react-jsonschema-form that referenced this issue Aug 23, 2019
@epicfaace
Copy link
Member

It looks like calling the .submit() event is different from dispatching an event, see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit

@KKS1
Copy link

KKS1 commented Oct 11, 2019

Thanks for looking into the fix. Is there an ETA on when this is targeted for merge and release creation ?

@KKS1
Copy link

KKS1 commented Oct 14, 2019

For anyone else having this issue, this is how I am resolving it-:

(function () {
  if (typeof Event !== 'function') {
    window.Event = CustomEvent;
  }
})();

along with adding https://www.npmjs.com/package/custom-event-polyfill.

epicfaace pushed a commit that referenced this issue Nov 9, 2019
* Fix #1431 - ie11 not able to submit

* Fix code formatting

* Add react-app-polyfill/ie11 for playground
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants