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

ReferenceError: event is not defined - Firefox #230

Open
aafaq-hassan-confiz opened this issue Nov 11, 2018 · 6 comments
Open

ReferenceError: event is not defined - Firefox #230

aafaq-hassan-confiz opened this issue Nov 11, 2018 · 6 comments

Comments

@aafaq-hassan-confiz
Copy link

I have just installed from master branch and on firefox (any version) following error shows in developer console:

"ReferenceError: event is not defined"

@wuarmin
Copy link

wuarmin commented Dec 18, 2018

I observe the same issue on FF.

@Robdel12 Robdel12 self-assigned this Dec 21, 2018
@Robdel12
Copy link
Collaborator

Thanks for reporting this! I'm going to try and take a look tonight / over the weekend / over the break.

@Robdel12
Copy link
Collaborator

Robdel12 commented Dec 21, 2018

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?

CodeSandbox
Small description for my-app goes here

wuarmin added a commit to wuarmin/emberx-select that referenced this issue Jan 7, 2019
@aandis
Copy link

aandis commented Feb 14, 2019

+1 Very annoying.

@aandis
Copy link

aandis commented Feb 14, 2019

@Robdel12 screenshot if it helps.

select

@corrspt
Copy link

corrspt commented Jul 18, 2019

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 ?

@Robdel12 Robdel12 removed their assignment Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants