d3 / d3-drag

Drag and drop SVG, HTML or Canvas using mouse or touch input.

Home Page:https://d3js.org/d3-drag

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-cancelable event

rowanc1 opened this issue · comments

I am getting errors in the noevent.js file saying:

Ignored attempt to cancel a touchmove event with cancelable=false, for example because scrolling is in progress and cannot be interrupted.

The advice I have seen around the internet is to add a:

export default function() {
  if (event.cancelable) event.preventDefault();
  event.stopImmediatePropagation();
}

image

Let me know if you want me to open a PR!


Version: 1.2.5
Using: Chrome 81.0.4044.122 (in emulator)
Platform: Mac

This seems similar to d3/d3-zoom#195 and d3/d3-zoom#175 ; it would be nice to be able to reproduce the issue with a given webpage and browser.

This happens to me as well in an Ionic (https://ionicframework.com/) project with the touch inputs turned on in Chrome.

I suspect it may be related to the ion-content since it has it's own scroll logic.

I believe this was because the event listeners were not declared non-passive, which was the historical default, but broken in recent browsers. Hence, this is a duplicate of #78 which is now fixed.