diff --git a/README.md b/README.md index c95740711..2b12071e5 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ var sortable = new Sortable(el, { forceFallback: false, // ignore the HTML5 DnD behaviour and force the fallback to kick in fallbackClass: "sortable-fallback", // Class name for the cloned DOM Element when using forceFallback - fallbackOnBody: false, // Appends the cloned DOM Element into the Document's Body + fallbackOnto: document.body, // Appends the cloned DOM Element to the specified element, defaults to current element fallbackTolerance: 0, // Specify in pixels how far the mouse should move before it's considered as a drag. dragoverBubble: false, diff --git a/src/Sortable.js b/src/Sortable.js index 72f571c82..4543c0498 100644 --- a/src/Sortable.js +++ b/src/Sortable.js @@ -391,7 +391,7 @@ function Sortable(el, options) { touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, forceFallback: false, fallbackClass: 'sortable-fallback', - fallbackOnBody: false, + fallbackOnto: el, fallbackTolerance: 0, fallbackOffset: {x: 0, y: 0}, // Disabled on Safari: #1571; Enabled on Safari IOS: #2244 @@ -716,7 +716,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ { } try { - + if (document.selection) { _nextTick(() => { document.selection.empty(); @@ -867,7 +867,7 @@ Sortable.prototype = /** @lends Sortable.prototype */ { // Bug if using scale(): https://stackoverflow.com/questions/2637058 // Not being adjusted for if (!ghostEl) { - let container = this.options.fallbackOnBody ? document.body : rootEl, + let container = this.options.fallbackOnto, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options; diff --git a/st/app.js b/st/app.js index a4853f3ec..dbe68bf02 100644 --- a/st/app.js +++ b/st/app.js @@ -202,7 +202,7 @@ for (var i = 0; i < nestedSortables.length; i++) { new Sortable(nestedSortables[i], { group: 'nested', animation: 150, - fallbackOnBody: true, + fallbackOnto: document.body, swapThreshold: 0.65 }); } diff --git a/tests/single-list-fallback.html b/tests/single-list-fallback.html new file mode 100644 index 000000000..5a5172eb3 --- /dev/null +++ b/tests/single-list-fallback.html @@ -0,0 +1,41 @@ + + +
+