Browse Source

fix: make drag on touch work in scrollable element

With Chrome version 56 the passive capture option in addEventListener defaults to true instead of false which causes dragging on touch devices to simultaneously also scroll.
Tested on Android Chrome, and device mode in Edge, Chrome and Firefox.
pull/1043/head
Elon Mallin 8 years ago committed by GitHub
parent
commit
7bd21a9583
  1. 13
      Sortable.js

13
Sortable.js

@ -26,6 +26,16 @@
};
}
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function() {
supportsPassive = true;
}
});
window.addEventListener("test", null, opts);
} catch (e) {}
var dragEl,
parentEl,
ghostEl,
@ -67,7 +77,7 @@
$ = win.jQuery || win.Zepto,
Polymer = win.Polymer,
captureMode = false,
captureMode = supportsPassive ? {capture: false, passive: false} : false,
supportDraggable = !!('draggable' in document.createElement('div')),
supportCssPointerEvents = (function (el) {
@ -230,7 +240,6 @@
// Export instance
el[expando] = this;
el.style['touch-action'] = 'none'; // #1022
// Default options
var defaults = {

Loading…
Cancel
Save