Closed MarkJPerry closed 4 years ago
event.cancelable && event.preventDefault()
should fix it but I haven't been able to reproduce the issue.
https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault says:
Calling preventDefault() for a non-cancelable event has no effect.
and in my tests (https://observablehq.com/d/968b050af2fcec8e) I don't see anything (tested with Chrome, Firefox, Safari on MacOS).
Please send more information on how to reproduce this issue?
When touching and dragging on a d3 graph which is handling touch events to provide "pinch to zoom" functionality the following errors appear in the browser console.
After some reading regarding the error the cause could possibly be found in:
https://github.com/d3/d3-zoom/blob/3c95789cd05cb04b99d568ddf4772d2cb58a8a0e/src/noevent.js#L8
where the
event.preventDefault()
is being used before checking if the event can be cancelled. Should be possible to fix by wrapping in a simple if statement?