jquery / jquery-ui

The official jQuery user interface library.
https://jqueryui.com
Other
11.26k stars 5.33k forks source link

draggable + sortable offset is wrong #2001

Closed barisusakli closed 2 years ago

barisusakli commented 2 years ago

After upgrading from 1.12.1 to 1.13.0 dragging an item to a sortable causes the helper to go out of page when it is over the sortable.

The code to create the draggable is below.

    $('#widgets .available-widgets .widget-panel').draggable({
            helper: 'clone',
            distance: 10,
            connectToSortable: '.widget-area',
        });

Same code works fine on 1.12.1. Feel free to close if this is already reported since I saw some other issues with draggable on 1.13.0

mgol commented 2 years ago

Thanks for the report. Can you provide a test case on JS Bin? Thanks!

barisusakli commented 2 years ago

Hi @mgol here is a jsbin https://jsbin.com/cibumufeni/1/edit?html,css,js,output

This uses 1.12.1 and the drag/drop works. If you change the library included to 1.13.0 it will cause the issue you see in the gif above.

mgol commented 2 years ago

Thanks! That confirms it.

mgol commented 2 years ago

I bisected it to c866e455373028a62a0956455a229fef63e91fac. PR that introduced the regression: #1793.

mgol commented 2 years ago

Fix at #2009: restoring one removal from #1793 fixes the issue.

mgol commented 2 years ago

jQuery UI 1.13.1 including a fix for this issue has been released: https://blog.jqueryui.com/2022/01/jquery-ui-1-13-1-released/.

gaojianzhuang commented 2 years ago

I used the 1.13.1, I have another issue, when drag the element into the iframe and sortable, the cloned element offset change, but end sortable, the offset works again. rl6uh-c8xbw

Anybody can help figure out the root cause? Thanks. BTW, when start the drag operation, the drag not smoothly and feel some lags.

mgol commented 2 years ago

@gaojianzhuang This issue is closed. If you have another similar one, please open a new issue and provide a runnable test case without third-party libraries.