question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chrome Intervention: Unable to preventDefault inside passive event listener due to target being treated as passive.

See original GitHub issue

There 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

https://github.com/lukaszflorczak/vue-agile/blob/18f8336215874b310d780675d70c8a30728bc80d/src/Agile.vue#L221

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:open
  • Created 4 years ago
  • Reactions:6
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lukaszflorczakcommented, Apr 16, 2020

Should be fixed in version v1.0.12

0reactions
DRBraggcommented, Jun 17, 2020

Unfortunately I’m running into the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to preventDefault inside passive event listener
This is a helpful article to understand the problem: developer.chrome.com/blog/scrolling-intervention Quoting: "impacted pages are fixed relatively easily by ...
Read more >
[Chrome] Unable to preventDefault inside passive event ...
I get this error in Chrome Console and a the same error will ... inside passive event listener due to target being treated...
Read more >
Unable to preventDefault inside passive event listener
I see in Chrome console many Errors: [Intervention] Unable to preventDefault inside passive event listener due to target being treated as ...
Read more >
VTK.js Unable to preventDefault inside passive event listener
RenderWindowInteractor.js:26 [Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive.
Read more >
SmoothScroll.js - AbleCommerce
I was seeing errors in Chrome coming from SmoothScroll.js: "Unable to preventDefault inside passive event listener due to target being treated as passive."...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found