Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignored attempt to cancel a touchmove event with cancelable=false #195

Closed
MarkJPerry opened this issue Oct 25, 2019 · 2 comments
Closed

Comments

@MarkJPerry
Copy link

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.

image

After some reading regarding the error the cause could possibly be found in:

event.preventDefault();

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?

@Fil
Copy link
Member

Fil commented May 29, 2020

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).

@Fil
Copy link
Member

Fil commented Jul 15, 2020

Please send more information on how to reproduce this issue?

@Fil Fil closed this as completed Jul 15, 2020
souljorje added a commit to souljorje/d3-zoom that referenced this issue Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants