Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

draggable + sortable offset is wrong #2001

Closed
barisusakli opened this issue Oct 27, 2021 · 8 comments · Fixed by #2009
Closed

draggable + sortable offset is wrong #2001

barisusakli opened this issue Oct 27, 2021 · 8 comments · Fixed by #2009

Comments

@barisusakli
Copy link

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
Copy link
Member

mgol commented Oct 28, 2021

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

@barisusakli
Copy link
Author

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
Copy link
Member

mgol commented Oct 29, 2021

Thanks! That confirms it.

@mgol mgol removed the Needs info label Oct 29, 2021
@mgol
Copy link
Member

mgol commented Nov 7, 2021

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

@mgol mgol mentioned this issue Nov 7, 2021
mgol added a commit to mgol/jquery-ui that referenced this issue Nov 7, 2021
PR jquerygh-1793 removed setting `this.offset.parent` in the Draggable
`refreshPositions` method which broke position calculations when moving
a Draggable item into a connected Sortable. restore that assignment.

Ref jquerygh-1793
Fixes jquerygh-2001
@mgol
Copy link
Member

mgol commented Nov 7, 2021

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

mgol added a commit to mgol/jquery-ui that referenced this issue Nov 8, 2021
PR jquerygh-1793 removed setting `this.offset.parent` in the Draggable
`refreshPositions` method which broke position calculations when moving
a Draggable item into a connected Sortable. restore that assignment.

Ref jquerygh-1793
Fixes jquerygh-2001
mgol added a commit that referenced this issue Nov 15, 2021
PR gh-1793 removed setting `this.offset.parent` in the Draggable
`refreshPositions` method which broke position calculations when moving
a Draggable item into a connected Sortable. restore that assignment.

Ref gh-1793
Fixes gh-2001
Closes gh-2009
@mgol
Copy link
Member

mgol commented Jan 20, 2022

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
Copy link

gaojianzhuang commented Jun 20, 2022

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
Copy link
Member

mgol commented Jun 21, 2022

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment