Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#9314 closed bug (fixed)

Sortable: Items cannot be dragged directly into bottom position

Reported by: BenjaminRH Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.sortable Version: 1.10.3
Keywords: regression Cc:
Blocked by: Blocking:

Description

With two or more connected sortables, items cannot be dragged straight to the bottom of a connected sortable. If the item is dragged to the top or middle of the sortable, it can then be dragged to the bottom.

Further, once an item has been "introduced" to a connected sortable (i.e. dragged somewhere and triggered a placeholder, but not dropped), it can be dragged (but not dropped) back to the first sortable, and then dragged straight to the bottom of the connected one.

http://jsfiddle.net/GBzV7/

Change History (19)

comment:1 Changed 10 years ago by tj.vantoll

Status: newopen
Summary: Items can't be dragged to the bottom of connected sortables without being dragged somewhere else in the connected sortable firstSortable: Items cannot be dragged directly into bottom position
Version: 1.9.21.10.3

Reduced and confirmed against master: http://jsfiddle.net/tj_vantoll/NjBLd/. You cannot drag an item from one connected sortable directly into the bottom position of another. I've played with various configurations of height/padding/margin and the behavior seems to occur regardless.

comment:2 Changed 10 years ago by tj.vantoll

#9365 is a duplicate of this ticket.

comment:3 Changed 10 years ago by tj.vantoll

#9370 is a duplicate of this ticket.

comment:4 Changed 10 years ago by tj.vantoll

Keywords: regression added

Per #9370 this was a regression introduced in 1.10.2.

comment:5 Changed 10 years ago by tj.vantoll

#9381 is a duplicate of this ticket.

comment:6 Changed 10 years ago by tj.vantoll

Another good test case from dylanpyle in #9381: http://jsfiddle.net/VNZW8/. It looks like the placeholder is being put in the first position when it should be in the last one.

comment:7 Changed 10 years ago by tj.vantoll

Guessing this was caused by this commit but haven't confirmed that yet: https://github.com/jquery/jquery-ui/commit/89473f6557662d905a63faa3ae3520bf3715a7e8.

comment:8 in reply to:  6 ; Changed 10 years ago by BenjaminRH

Replying to tj.vantoll:

Another good test case from dylanpyle in #9381: http://jsfiddle.net/VNZW8/. It looks like the placeholder is being put in the first position when it should be in the last one.

This certainly isn't happening all the time though. My test case and other website with this bug don't place the placeholder in the first position. Are you sure that's a duplicate?

comment:9 Changed 10 years ago by rebecca.tillman

I have a similar issue. I have a sortable parent list that may or may not have sortable sub items. These sub items can be moved from one parent item to another. If you want to move a sub item to an empty parent item you can't without first sorting over other sub items (if there are any). Here's the jsfiddle http://jsfiddle.net/ZwaT3/

I found that the following if statement in the sortable widget _contactContainers function seems to be the cause of the issue.

if(this.currentContainer === this.containers[innermostIndex]) {
     return;
}

(In 10.2 this is around ln 890 in the jquery.ui.sortable.js file and ln 4352 in jquery-ui.js)

This if statement was added by commit https://github.com/jquery/jquery-ui/commit/89473f6557662d905a63faa3ae3520bf3715a7e8 in relation to ticket #8792.

comment:10 in reply to:  8 Changed 10 years ago by tj.vantoll

Replying to BenjaminRH:

Replying to tj.vantoll:

Another good test case from dylanpyle in #9381: http://jsfiddle.net/VNZW8/. It looks like the placeholder is being put in the first position when it should be in the last one.

This certainly isn't happening all the time though. My test case and other website with this bug don't place the placeholder in the first position. Are you sure that's a duplicate?

I'm pretty positive that it has the same root cause (i.e. the same commit caused the issue), but from what you said this does sound like a separate issue. I'm guessing if one is fixed the other will be addressed as well, but to be safe I reopened #9381.

Thanks.

comment:11 Changed 10 years ago by Kris Borchers

Resolution: fixed
Status: openclosed

Sortable: Adjust itemWithLeastDistance algorithm in _contactContainers to properly handle dragging items to the beginning and ends of lists. Fixes #9314 - Sortable: Items cannot be dragged directly into bottom position. Fixes #9381 - Sortable: Connected list placeholders have an inaccurate initial position

Changeset: 601ad962e0a417bb369378ed7704a0b493eac365

comment:12 Changed 10 years ago by Scott González

Milestone: none1.11.0

comment:13 Changed 10 years ago by tj.vantoll

#9607 is a duplicate of this ticket.

comment:14 Changed 10 years ago by thardy

I'm seeing this same behavior as well, and it's very frustrating. Just some encouragement here to let you know this fix is very much anticipated.

Thanks.

comment:15 Changed 10 years ago by tj.vantoll

#9773 is a duplicate of this ticket.

comment:16 Changed 10 years ago by blaze34

I found when this bug happened.

In method _contactContainers finding itemWithLeastDistance (closest item from current dragged item) and this.direction (where need set placeholder after or before itemWithLeastDistance). Reason - wrong direction, because on over sortable first time all inner items have height 0.

comment:17 Changed 9 years ago by dnlmzw

Any news on the subject? I'm experiencing this issue, but didn't seem to find an answer to fix it, in the comments here. Anyone knows of an update coming out in a near future - or can direct me to a something that will fix this issue? Thanks in advance.

Last edited 9 years ago by dnlmzw (previous) (diff)

comment:18 in reply to:  17 Changed 9 years ago by tj.vantoll

Replying to dnlmzw:

Any news on the subject? I'm experiencing this issue, but didn't seem to find an answer to fix it, in the comments here. Anyone knows of an update coming out in a near future - or can direct me to a something that will fix this issue? Thanks in advance.

A fix for this is included in 1.11. You can try out the beta release: http://blog.jqueryui.com/2014/04/jquery-ui-1-11-0-beta-1/

comment:19 Changed 9 years ago by tj.vantoll

#10055 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.