-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Sortable: fix wrong initial helper position in scrolled container (#15021) #1749
Conversation
move assignment of this.cssPosition above code that calls _getParentPosition and _getRelativeOffset so that this.cssPosition isn't undefined in those methods. This is a fix for issue #15021 - sortable initially gets the helper position wrong if the sortable list is in a scrolling element.
Thank you for your pull request. It looks like this may be your first contribution to a jQuery Foundation project, if so we need you to sign our Contributor License Agreement (CLA). 📝 Please visit http://contribute.jquery.org/CLA/ to sign. After you signed, the PR is checked again automatically after a minute. If there's still an issue, please reply here to let us know. If you've already signed our CLA, it's possible your git author information doesn't match your CLA signature (both your name and email have to match), for more information, check the status of your CLA check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like it would break existing code.
@@ -219,6 +219,11 @@ return $.widget( "ui.sortable", $.ui.mouse, { | |||
left: this.offset.left - this.margins.left | |||
}; | |||
|
|||
// Only after we got the offset, we can change the helper's position to absolute |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is now wrong.
@@ -231,11 +236,6 @@ return $.widget( "ui.sortable", $.ui.mouse, { | |||
relative: this._getRelativeOffset() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this now broken for relative positioned elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah my bad. not sure how the relative position works since we're always setting it to absolute. but i've moved it around so relative offset is set before the position is changed to absolute.
don't change position until relative offsets defined
fix whitespace
fix whitespace
move assignment of this.cssPosition above code that calls _getParentPosition and _getRelativeOffset so that this.cssPosition isn't undefined in those methods.
This is a fix for issue #15021 - sortable initially gets the helper position wrong if the sortable list is in a scrolling element.