drift icon indicating copy to clipboard operation
drift copied to clipboard

Passive event listeners don't allow preventDefault()

Open claudio147 opened this issue 3 years ago • 3 comments

It seems that you register the event listeners with the options parameter false as default. The browser changes this options to image

Happens in this Method (Trigger.js):

  _bindEvents() {
    this.settings.el.addEventListener("mouseenter", this._handleEntry, false);
    this.settings.el.addEventListener("mouseleave", this._hide, false);
    this.settings.el.addEventListener("mousemove", this._handleMovement, false);

    const isPassive = { passive: this.settings.passive };
    if (this.settings.handleTouch) {
      this.settings.el.addEventListener("touchstart", this._handleEntry, isPassive);
      this.settings.el.addEventListener("touchend", this._hide, false);
      this.settings.el.addEventListener("touchmove", this._handleMovement, isPassive);
    } else {
      this.settings.el.addEventListener("touchstart", this._preventDefault, isPassive);
      this.settings.el.addEventListener("touchend", this._preventDefault, false);
      this.settings.el.addEventListener("touchmove", this._preventDefault, isPassive);
    }
  }

Guess when you define the options instead of just using "false" as an option parameter will fix this issue.

Screenshots image

Information:

  • drift version: v1.5.0
  • browser version: https://www.whatsmybrowser.org/b/AVRWC

claudio147 avatar Oct 18 '21 15:10 claudio147

Hey @claudio147 thanks for opening this issue. I'll look into this over the next day or so and get back to you with any updates.

sherwinski avatar Oct 19 '21 05:10 sherwinski

@sherwinski

if(e.cancelable)
    e.preventDefault();

makethemesgreatagain avatar Oct 23 '21 22:10 makethemesgreatagain

@sherwinski Any updates on this?

claudio147 avatar Mar 02 '22 09:03 claudio147

Hey @claudio147, I'm sorry it's been a while. We had some high priorities issues that took our eye off the ball here.

We're still planning on getting to this. I can't give you an exact time estimate, but we'll update you as soon as we get a chance to tackle this.

Thanks again for reporting this issue.

luqven avatar Sep 27 '22 17:09 luqven

@claudio147 , could you kindly test the given PR #672 and see if the issue persists? Thank you!

sisco0 avatar Oct 05 '22 03:10 sisco0