Skip to content

Commit 20e6064

Browse files
zhizhangchenscottgonzalez
authored andcommitted
Draggable: Fix a bug when dragging into nested sortables there are duplicated placeholders. Fixes #7777 - Draggable and Nested Sortables bug.
1 parent 77a4aaf commit 20e6064

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ui/jquery.ui.draggable.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,29 @@ $.ui.plugin.add("draggable", "connectToSortable", {
571571

572572
$.each(inst.sortables, function(i) {
573573

574+
var innermostIntersecting = false;
575+
var thisSortable = this;
574576
//Copy over some variables to allow calling the sortable's native _intersectsWith
575577
this.instance.positionAbs = inst.positionAbs;
576578
this.instance.helperProportions = inst.helperProportions;
577579
this.instance.offset.click = inst.offset.click;
578580

579581
if(this.instance._intersectsWith(this.instance.containerCache)) {
582+
innermostIntersecting = true;
583+
$.each(inst.sortables, function () {
584+
this.instance.positionAbs = inst.positionAbs;
585+
this.instance.helperProportions = inst.helperProportions;
586+
this.instance.offset.click = inst.offset.click;
587+
if (this != thisSortable
588+
&& this.instance._intersectsWith(this.instance.containerCache)
589+
&& $.ui.contains(thisSortable.instance.element[0], this.instance.element[0]))
590+
innermostIntersecting = false;
591+
return innermostIntersecting;
592+
});
593+
}
594+
580595

596+
if(innermostIntersecting) {
581597
//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once
582598
if(!this.instance.isOver) {
583599

0 commit comments

Comments
 (0)