svg-pan-zoom icon indicating copy to clipboard operation
svg-pan-zoom copied to clipboard

Chrome 74: Unable to preventDefault inside passive event listener due to target being treated as passive.

Open SvetlozarValchev opened this issue 5 years ago • 12 comments

Bug report

Expected behaviour

No errors in Dev Console

Actual behaviour

When Zooming in/out, the console repeatedly logs the following error: Unable to preventDefault inside passive event listener due to target being treated as passive.

Steps to reproduce the behaviour

  1. Zoom In/Out
  2. Observe Dev Console

Configuration

  • svg-pan-zoom version: 3.6.0
  • Browser(s): Chrome 74
  • Operating system(s): Windows 10 Pro

SvetlozarValchev avatar May 15 '19 15:05 SvetlozarValchev

I have same problem about this

Vktun avatar May 22 '19 05:05 Vktun

I have the same problem.

TrishE avatar Jun 12 '19 13:06 TrishE

I have the same problem.

azhengyongqin avatar Jun 20 '19 09:06 azhengyongqin

You can get rid of the message by commenting line 845 in the the library ( i included the file in a browser app at the moment so I'll just drop the code you need to find. Probably not the best way but it works and didn't break anything for now.

` /** * Handle mouse wheel event * * @param {Event} evt */

SvgPanZoom.prototype.handleMouseWheel = function(evt) {
  if (!this.options.zoomEnabled || this.state !== "none") {
    return;
  }

  if (this.options.preventMouseEventsDefault) {
    if (evt.preventDefault) {
      // evt.preventDefault(); COMMENT THIS LINE
    } else {
      evt.returnValue = false;
    }
  }

ethubert avatar Oct 10 '19 08:10 ethubert

Hi @SvetlozarValchev, could you review this pull request to verify it solves this issue: https://github.com/ariutta/svg-pan-zoom/pull/355 Thanks!

ariutta avatar Oct 29 '19 16:10 ariutta

I can confirm I no longer can reproduce the issue.

SvetlozarValchev avatar Oct 30 '19 05:10 SvetlozarValchev

Doesnt this change zoom the svg and scrools the browser window at the same time then (if the page that hosts the svg is scrollable cause of long content? I think the purpose of this preventDefault() here is to prevent that scrolling.

gingerr avatar Oct 30 '19 11:10 gingerr

@SvetlozarValchev thanks for checking. Just to clarify, which code did you test for reproducing the issue: current master or pull request #355?

ariutta avatar Oct 30 '19 16:10 ariutta

@gingerr you're talking about pull request #355, right?

ariutta avatar Oct 30 '19 16:10 ariutta

For now people who encounter this issue may try cloning and building from https://github.com/Bigfellahull/svg-pan-zoom, the repo from where the PR came. That´s what I did and it worked.

BodoMinea avatar Apr 19 '20 07:04 BodoMinea

@BodoMinea you did a great job, but I assume that you intentionally did not want to push the built dist result ?

I created a fork including the file ready to be used, I have to admit that this great library is unusable without this fix.

https://github.com/WebSVG/svg-pan-zoom/tree/master/dist

wassfila avatar Jan 16 '21 13:01 wassfila

Still experiencing this issue with version 3.12.1. Any file I can change now that will fix this with the newest chrome version?

connerkennedy32 avatar Nov 30 '23 18:11 connerkennedy32