Chrome Intervention: Unable to preventDefault inside passive event listener due to target being treated as passive.
See original GitHub issueThere is a error in google chrome browser:
[Intervention] Unable to preventDefault inside passive event listener
due to target being treated as passive.
This happens due to line 221 in Agile.vue
First of all using document.ontouchmove
is quite bad practice, as it is not widely implemented as stated in the note in https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/ontouchmove
The actual problem is, that the GlobalEventHandlers.ontouchmove is treated as passive and because of that, it cannot call preventDefault()
, as explained under options - passive in
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters
“A Boolean which, if true, indicates that the function specified by listener will never call preventDefault(). If a passive listener does call preventDefault(), the user agent will do nothing other than generate a console warning. See Improving scrolling performance with passive listeners to learn more.”
So instead you would have to call once:
document.addEventListener("touchmove", somefunction, {passive: false})
Within the callback you could than decide to call preventDefault()
on the event, if you want to disable default scrolling. For that you would have to set some variable in the state …
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:12 (3 by maintainers)
Top GitHub Comments
Should be fixed in version
v1.0.12
Unfortunately I’m running into the same issue