gblazex/smoothscroll-for-websites

Errors when trying to use the wheel function in the mouse

Opened this issue · 3 comments

I'm getting the following error in Chrome V73+:

The Issue

Google has updated their Browser policy with regards to mouse wheel events see here: https://developers.google.com/web/updates/2019/02/scrolling-intervention

The error in this github repo

Dev-Tools says the following error:

[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/6662647093133312

Link ref: https://www.chromestatus.com/features/6662647093133312

This is your plugin error in Chrome V74:

error

Solution

I did some research and Googler's RByers has repeatably given the same answer throughout the web which I will add some links of his comments:

https://stackoverflow.com/questions/42101723/unable-to-preventdefault-inside-passive-event-listener/42288386#42288386

oliviertassinari/react-swipeable-views#183 (comment)

The solution by many other scrolling scripts has been to do the following:

Either adding touch-action: none or touch-action: manipulation for more info see here: https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action

Google's direct link to the solution is here: https://developers.google.com/web/updates/2017/01/scrolling-intervention#breakage_and_guidance

The above link is also linked in their "Making wheel scrolling fast by default" web page as a solution.

Hello, I've fixed it for me. I changed the line 591

window.addEventListener(type, fn, false);

by

window.addEventListener(type, fn, {passive: false});

As indicated at the end of https://developers.google.com/web/updates/2019/02/scrolling-intervention

I do not know if it's the best, but it works.

fixed in the latest 1.4.9 version in a backwards compatible way.