Opened 6 years ago

Last modified 4 years ago

#8961 open bug

Sortable: Intermittently unable to sort while dragging and scrolling

Reported by: CezarisLT Owned by:
Priority: minor Milestone: none
Component: ui.sortable Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:

Description

It appliers there seems to be a problem with big scrollable items and overflow:scroll.

http://jsfiddle.net/mhXLJ/1/

Try and move item 1 down to bottom and you will see the placeholder will fail and cannot be dropped, moving it around a bit seems to fix it.

Setting the tolerance to "pointer" seems to half fix this bug.

Change History (6)

comment:1 Changed 6 years ago by tj.vantoll

Hi CazarisLT,

Thanks for taking the time to contribute to the jQuery UI project. I can see the issue in your test case. The issue seems to be that the plugin doesn't correctly account for the fact that a scroll has occurred until you move it around a bit.

Therefore, I think this might be a duplicate of #5039. Thoughts? cc mikesherov

Last edited 6 years ago by tj.vantoll (previous) (diff)

comment:2 Changed 6 years ago by tj.vantoll

Milestone: 1.10.0none

comment:3 Changed 6 years ago by tj.vantoll

Status: newopen
Summary: sortable: Strange behaviour on big item and overflow:scrollSortable: Intermittently unable to sort while dragging and scrolling

I don't believe this is caused by #5039 as it has to deal with the page scroll and this is caused by scrolling within a single element.

This also has nothing to do with the size of the items as I can recreate the problem with much smaller ones, here's a reduced test case http://jsfiddle.net/tj_vantoll/Sb4GT/.

The issue is that when you scroll, occasionally when scrolling you have to shake the mouse a bit for it to recognize the new positions of the sortable items. This is most noticeable when scrolling up but occurs in both directions.

comment:4 Changed 5 years ago by Victor Homyakov

When you scroll and scrollLeft or scrollTop of container changes, positions of sortable items (i.e. top and left) should be updated as well, otherwise widget is comparing *new* position of mouse pointer with *old* cached positions of sortable items.

In fact, when you are shaking your mouse without scroll, widget refreshes positions of items (https://github.com/jquery/jquery-ui/blob/master/ui/sortable.js#L411 calls _rearrange, and then this.refreshPositions() is invoked).

Calling this.refreshPositions(true) after scroll in _mouseDrag either eliminates this bug or at least makes it less noticeable: http://jsfiddle.net/Sb4GT/1/

comment:6 Changed 4 years ago by titobf

This was very helpful. Thanks Victor!!

Note: See TracTickets for help on using tickets.