How to solve the "non-passive event listener ..." google chrome console message

1.2k Views Asked by At

I made a wordpress plugin used by slick slider, but the slick github project didnt get update related this chrome warning.I dont want change my plugin and search different slider.So, How can I solve this error in shortest way?

I know there are many question about this issue but this question is not dublicate because the answers give same code and I couldnt solve my problem with the code.

What must I do with below code:

 addEventListener(document, "touchstart", function(e) {
    console.log(e.defaultPrevented);  // will be false
    e.preventDefault();   // does nothing since the listener is passive
    console.log(e.defaultPrevented);  // still false
  }, Modernizr.passiveeventlisteners ? {passive: true} : false);
1

There are 1 best solutions below

1
On

A bit late to the game, but still:

As many users reported this problem, I integrated a solution into my own fork of slick slider.

To solve the slick slider issue with passive listeners, you can use this fork of slick. It integrates the fix:

https://github.com/nicolaskopp/slick

You can also grab the patch here and use for your own fork, if you like:

https://github.com/kenwheeler/slick/pull/3422