]> source.dussan.org Git - jquery-ui.git/commitdiff
Sortable: Fix parent offset detection
authorRobin <mail@robin-fowler.com>
Fri, 23 Sep 2016 11:40:36 +0000 (12:40 +0100)
committerScott González <scott.gonzalez@gmail.com>
Tue, 4 Oct 2016 15:05:01 +0000 (11:05 -0400)
Fixes #15021
Closes gh-1749

ui/widgets/sortable.js

index 8d2ada59a87cb4f2018d4f160e8bad274c3541d3..f7298ebe53f504e27d9c79183913b5db90f65d1b 100644 (file)
@@ -224,18 +224,22 @@ return $.widget( "ui.sortable", $.ui.mouse, {
                                left: event.pageX - this.offset.left,
                                top: event.pageY - this.offset.top
                        },
-                       parent: this._getParentOffset(),
 
                        // This is a relative to absolute position minus the actual position calculation -
                        // only used for relative positioned helper
                        relative: this._getRelativeOffset()
                } );
 
-               // Only after we got the offset, we can change the helper's position to absolute
+               // After we get the helper offset, but before we get the parent offset we can
+               // change the helper's position to absolute
                // TODO: Still need to figure out a way to make relative sorting possible
                this.helper.css( "position", "absolute" );
                this.cssPosition = this.helper.css( "position" );
 
+               $.extend( this.offset, {
+                       parent: this._getParentOffset()
+               } );
+
                //Generate the original position
                this.originalPosition = this._generatePosition( event );
                this.originalPageX = event.pageX;