d3/d3-zoom

Passive Eventlisteners

Closed this issue · 1 comments

Some Browsers show the warning:

[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive.

because zoom adds touchstart-, touchmove-, touchend-, wheel-, dblclick- and mousedown- eventlisteners as non-passive. Would it break the functionality of zoom, if you make them passive by adding the option?

You’re welcome to try it and see, but I don’t think these should be passive listeners since the zoom behavior is intended to prevent scrolling. However, it’s slightly more complicated than that because it can prevent the default behavior on touchstart because that would prevent the emulated click event from triggering.