Chrome Scrolling Error - Passive Event Listeners

#1

Hey guys,

Anyone ever had to deal with this error message on Chrome DevTools:

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

I am having this issue right now… there are a few pages of my app that when entered freeze the scrolling - but once refreshed, everything works ok.

It seems like the issue is that the newest Chrome release is treating any event listeners that weren’t tagged as { passive: false } as passive, and denying an “event.preventDefault()” for them - as a result, when you try to scroll the error appears on DevTools (funny thing: the more you try to scroll, the more the same error appears over and over).

I found this solution:
If you do not want to this to happen, you can add { passive: false } as the third argument to .addEventListener ., but since I am using Blaze + jQuery, I never actually use .addEventListener.

Any ideas how to solve this?
Thanks!

#2

You could solve this issue by not hijacking scroll behaviour?

What are you doing in a scroll listener that needs preventDefault anyway?
Almost every time this is done it results in a worse user experience, which is why Google have made this change

1 Like
#3

You were right, I was using slimscroll and it was causing the error. After removing it everything looks fine.

1 Like