Skip to main content

Search and Top Navigation

#8961 open bug ()

Opened January 14, 2013 11:37PM UTC

Last modified July 30, 2014 09:29PM UTC

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.

Attachments (0)
Change History (6)

Changed January 15, 2013 01:26AM UTC by tj.vantoll comment:1

_comment0: 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 mikesherov1358213337636073

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

Changed January 25, 2013 09:23PM UTC by tj.vantoll comment:2

milestone: 1.10.0none

Changed March 23, 2013 11:13AM UTC by tj.vantoll comment:3

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.

Changed March 10, 2014 10:44AM UTC by victor-homyakov comment:4

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/

Changed March 10, 2014 10:48AM UTC by victor-homyakov comment:5

Changed July 30, 2014 09:29PM UTC by titobf comment:6

This was very helpful. Thanks Victor!!