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

paper-chips throws error on blur on Firefox #611

Closed
eduardoweiland opened this issue Jan 5, 2017 · 1 comment
Closed

paper-chips throws error on blur on Firefox #611

eduardoweiland opened this issue Jan 5, 2017 · 1 comment

Comments

@eduardoweiland
Copy link

This seems similar to #606 but it's a bit different. Can be reproduced on the demo page when using Firefox (this error does not occur in Chromium). Just clicking on the field then clicking out of it gives the error ReferenceError: event is not defined. The field keeps the focused state after loosing focus.

Seems like it is caused by this line

if (!isEmpty(event) && !isEmpty(event.relatedTarget) && this.$(event.relatedTarget).is(selector)) {
.

if (!isEmpty(event) && !isEmpty(event.relatedTarget) && this.$(event.relatedTarget).is(selector)) {
  return true;
}

The variable event seems to be global. Replacing it with window.event seems to solve the issue.

@eduardoweiland eduardoweiland changed the title paper-chips throws error on focus out on Firefox paper-chips throws error on blur on Firefox Jan 5, 2017
@pauln
Copy link
Contributor

pauln commented Jan 8, 2017

window.event doesn't seem to fix the issue for me, but passing the event through from the calling functions does. Note, however, that you need to be using Firefox 48 or higher, as earlier versions don't have support for mouseEvent.relatedTarget - so it's not possible to tell where the focus is moving to in a blur event (without ugly workarounds using setTimeout).

pauln added a commit to pauln/ember-paper that referenced this issue Jan 8, 2017
Fixes miguelcobain#611 (paper-chips throws error on focus out on Firefox)
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

No branches or pull requests

2 participants