@@ -16,6 +16,7 @@ import {
1616 isTouchEvent ,
1717 provideDisplayName ,
1818 omit ,
19+ getScrollingParent ,
1920} from '../utils' ;
2021
2122export default function sortableContainer (
@@ -145,9 +146,10 @@ export default function sortableContainer(
145146
146147 this . contentWindow =
147148 typeof contentWindow === 'function' ? contentWindow ( ) : contentWindow ;
149+
148150 this . scrollContainer = useWindowAsScrollContainer
149151 ? this . document . scrollingElement || this . document . documentElement
150- : this . container ;
152+ : getScrollingParent ( this . container ) || this . container ;
151153
152154 for ( const key in this . events ) {
153155 if ( this . events . hasOwnProperty ( key ) ) {
@@ -318,7 +320,7 @@ export default function sortableContainer(
318320
319321 const margin = getElementMargin ( node ) ;
320322
321- const containerBoundingRect = this . container . getBoundingClientRect ( ) ;
323+ const containerBoundingRect = this . scrollContainer . getBoundingClientRect ( ) ;
322324 const dimensions = getHelperDimensions ( { index, node, collection} ) ;
323325
324326 this . node = node ;
@@ -341,8 +343,8 @@ export default function sortableContainer(
341343 this . offsetEdge = getEdgeOffset ( node , this . container ) ;
342344 this . initialOffset = getPosition ( event ) ;
343345 this . initialScroll = {
344- top : this . container . scrollTop ,
345- left : this . container . scrollLeft ,
346+ top : this . scrollContainer . scrollTop ,
347+ left : this . scrollContainer . scrollLeft ,
346348 } ;
347349
348350 this . initialWindowScroll = {
@@ -587,8 +589,8 @@ export default function sortableContainer(
587589 const { transitionDuration, hideSortableGhost, onSortOver} = this . props ;
588590 const nodes = this . manager . getOrderedRefs ( ) ;
589591 const containerScrollDelta = {
590- left : this . container . scrollLeft - this . initialScroll . left ,
591- top : this . container . scrollTop - this . initialScroll . top ,
592+ left : this . scrollContainer . scrollLeft - this . initialScroll . left ,
593+ top : this . scrollContainer . scrollTop - this . initialScroll . top ,
592594 } ;
593595 const sortingOffset = {
594596 left :
0 commit comments