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

Unable to preventDefault inside passive event listener due to target being treated as passive #36

Closed
mhadaily opened this issue Aug 7, 2018 · 3 comments
Assignees
Labels

Comments

@mhadaily
Copy link

mhadaily commented Aug 7, 2018

Hi
I was playing with the library a bit and it seems there an error in Chrome 68 at least.

[Intervention] Unable to preventDefault inside passive event listener due to the target being treated as passive. See https://www.chromestatus.com/features/5093566007214080 => iro.js:1025

iro.js:1025 is

switch (e.type) {
      ...
      case EVENT_MOUSEUP:
      case EVENT_TOUCHEND:
        this._mouseTarget = false;
        this.emit("input:end", this.color);
        unlisten(document, [EVENT_MOUSEMOVE, EVENT_TOUCHMOVE, EVENT_MOUSEUP, EVENT_TOUCHEND], this);
        break;
    }
    if (this._mouseTarget) {
      e.preventDefault();  // HERE IS LINE 1025 
    }
  }

I just wanted to inform you. If I continue using your library, I will fix and will send a PR.

Thanks for your cool library.

@jaames jaames self-assigned this Aug 7, 2018
@jaames jaames added the bug label Aug 7, 2018
@jaames
Copy link
Owner

jaames commented Aug 7, 2018

Thanks for letting me know! Just pushed a fix for this and updated the NPM package :)

@jaames jaames closed this as completed Aug 7, 2018
@mhadaily
Copy link
Author

mhadaily commented Aug 11, 2018

Thanks, it's was very quick but doesn't seem it solved the issue completely.

You might need to add one more thing to the color picker container element which is
touch-action: none;
More info: https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action
Thanks for your hard work.

@jaames
Copy link
Owner

jaames commented Aug 12, 2018

Ah got it, thanks for the tip!

touchmove events are now also passive, and the color picker's SVG root elements should also have touch-action: none; applied. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants