emberx-select
emberx-select copied to clipboard
ReferenceError: event is not defined - Firefox
I have just installed from master branch and on firefox (any version) following error shows in developer console:
"ReferenceError: event is not defined"
I observe the same issue on FF.
Thanks for reporting this! I'm going to try and take a look tonight / over the weekend / over the break.
I tried testing XSelect v4.0.0-beta.2 on codesandbox with Firefox 63 & 65 and couldn't reproduce. https://codesandbox.io/s/kkw0nk5j6v (you might have to edit a file, & hit save for the server to start on codesandbox 🤷♂️ )
Could anyone provide more info or a reproduction? or an error stack trade screenshot?
CodeSandboxSmall description for my-app goes here
+1 Very annoying.
@Robdel12 screenshot if it helps.
I can't reproduce this (Firefox 68) but I got an error from Sentry with this exact issue.
Sentry says that it happens in __setDefaultValues
like others here are mentioning.
What I found interesting was that looking at the code for __setDefaultValues
we see (this was checked today) this
__setDefaultValues() {
let canSet = !this.isDestroying && !this.isDestroyed;
if (canSet && this.get('value') == null) {
// `onChange` is the default event we use
this._handleAction('onChange', this._getValue(), event);
}
},
That event
variable that's passed to handleAction
is nowhere to be found on this code (not passed as argument, defined as parameter, local variable). I thought "of course, that must be it". But while debugging I found that event
is actually defined, so I assumed it's some implicit global variable
(because in both Chrome and Firefox it wasn't undefined).
Even more interesting is that in MDN there are some notes regarding to this (https://developer.mozilla.org/en-US/docs/Web/API/Window/event). Interesting, about compatibility... it says that Firefox started supporting this in version 63/65 but it was reverted.
Also interesting is that the Sentry report I got was from a Firefox of version 64
. In the MDN page they recommend:
This property can be fragile, in that there may be situations in which the returned Event is not the expected value. In addition, Window.event is not accurate for events dispatched within shadow trees.
So I think only a subset of Firefox versions are affected by this? (maybe 64). Not sure the solution, but maybe explicitly invoke handleAction
with window.event
?