Opened 7 years ago

Closed 7 years ago

#9082 closed bug (duplicate)

First time dragged element could have wrong offsets because "absolute" position is not set at helper

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

Description

There is a line with a comment in the code: Only after we got the offset, we can change the helper's position to absolute

And after this line "absolute" position is set to helper

this.helper.css("position", "absolute");

this.cssPosition = this.helper.css("position");

But before the comment line offset is extended, where offset.parent is set: parent: this._getParentOffset()

And _getParentOffset method uses "absolute" position to calculate real parent offset.

Moving offset extend method under

this.cssPosition = this.helper.css("position");

fixes the bug.

Change History (3)

comment:1 Changed 7 years ago by tj.vantoll

Owner: set to alexander_k
Status: newpending

Hi alexander_k,

Thanks for taking the time to contribute to the jQuery UI project. Can you please provide a reduced test case that shows the issue you are describing. You can use this as a starting point - http://jsfiddle.net/tj_vantoll/wjxe4/.

Thanks.

comment:2 Changed 7 years ago by Douglas_BTX

Thanks for setting up the jsfiddle outline tj.vantoll. Here's a reproduction: http://jsfiddle.net/wjxe4/37/

It only happens the first time, but pressing "Run" resets it ready to try again.

Last edited 7 years ago by Douglas_BTX (previous) (diff)

comment:3 Changed 7 years ago by tj.vantoll

Resolution: duplicate
Status: pendingclosed

Duplicate of #5039.
Thanks. This is a duplicate of #5039 but now we have a good reduced test case for that issue.

Note: See TracTickets for help on using tickets.