Description
As of Chrome 70, d3-zoom no longer works out of the box when using touch on desktop touchscreens. This is because Chrome has removed the ontouch*
element properties on desktop OSes, and d3-zoom's defaultTouchable
implementation relies on the presence of the ontouchstart
element property as its feature detection. It therefore thinks touch events are unsupported, even though they still are.
See https://www.chromestatus.com/feature/4764225348042752 for their explanation.
We can work around this on a case-by-case basis by overriding the touchable
config with our own implementation via zoom().touchable(...)
, but it would be nice to have a more reliable feature detection in defaultTouchable
. It sounds like checking for the presence of window.TouchEvent
should work ok but it would need proper cross-browser testing.
Alternative solutions might be: removing the filter altogether and just letting it attach unused touch event handlers in all cases, or adding a PointerEvents-based code path since that's apparently the recommended long-term approach.