-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
Issue with CustomEvent guard in input.ts onInput #227
Comments
Of course I would find the culprit after creating an issue. An old polyfill library (that I'm removing) called viewport-units-buggyfill is messing with CustomEvent. My question about adding e.isTrusted still stands though. |
Sorry for the delay. Aren't CustomEvents always not trusted? Or are you referring to the case where some library might mutate global events and create a CustomEvent that is also isTrusted? |
One would think. I don't fully understand why their CustomEvent polyfill is affecting the input event. It's causing a form field's input event to be both I think it has something to do with them inheriting the base Event's prototype: https://github.com/rodneyrehm/viewport-units-buggyfill/blob/master/viewport-units-buggyfill.js#L95 Anyway, this is really an edge case and probably won't affect 99% of people. |
Okay, should work in 3.0.1. Please check. |
Hi,
I'm switching from inputmask to maska to save some kb and I'm having trouble getting maska working.
On my input element, input events are always instanceof CustomEvent for some reason. Devtools doesn't show any listeners bound to the input. I have breaks on subtree modifications on the element's parent and that's showing nothing. I've tried disabling all browser extensions.. I've been at this for hours and I'm at a loss.
I tried cloning maska and running the dev server and it works fine there. So, obviously we've got something affecting the input event somewhere on our site.
Anyway.....
In maska's onInput handler, there is a guard at the beginning:
if (e instanceof CustomEvent && e.type === 'input') { return }
I presume this is to prevent infinite recursion when the setValue method dispatches its own input event on the element. I think it would be a good idea to check
e.isTrusted
. It tells if the event was initiated by the browser. The condition would change to this:if (e instanceof CustomEvent && e.type === 'input' && !e.isTrusted) { return }
It seems safer and has the benefit of fixing my issue. :D
Thoughts?
The text was updated successfully, but these errors were encountered: