I am trying to get a sidebar to scroll with the mouse wheel while the pointer is over it, while also preventing scrolling in the main window (ie the mouse wheel scrolls whichever window you are hovering over).
The scrollbar code is copied from a working jsfiddle for the sidebar scroll. Here is the part which stops the main window scrolling:
//stop window scroll
if (e.preventDefault) { e.preventDefault(); }
e.returnValue = false;
The problem is that the prevent default doesn't work and gives the error "Unable to preventDefault inside passive event listener". I assume somewhere in my wordpress theme the event listener is set to passive: true, but I'm not sure how to reset this to passive: false.
I have tried...
document.addEventListener('wheel', { passive: false })
...but get this error...