@@ -16,6 +16,7 @@ import {
16
16
isTouchEvent ,
17
17
provideDisplayName ,
18
18
omit ,
19
+ getScrollingParent ,
19
20
} from '../utils' ;
20
21
21
22
export default function sortableContainer (
@@ -145,9 +146,10 @@ export default function sortableContainer(
145
146
146
147
this . contentWindow =
147
148
typeof contentWindow === 'function' ? contentWindow ( ) : contentWindow ;
149
+
148
150
this . scrollContainer = useWindowAsScrollContainer
149
151
? this . document . scrollingElement || this . document . documentElement
150
- : this . container ;
152
+ : getScrollingParent ( this . container ) || this . container ;
151
153
152
154
for ( const key in this . events ) {
153
155
if ( this . events . hasOwnProperty ( key ) ) {
@@ -318,7 +320,7 @@ export default function sortableContainer(
318
320
319
321
const margin = getElementMargin ( node ) ;
320
322
321
- const containerBoundingRect = this . container . getBoundingClientRect ( ) ;
323
+ const containerBoundingRect = this . scrollContainer . getBoundingClientRect ( ) ;
322
324
const dimensions = getHelperDimensions ( { index, node, collection} ) ;
323
325
324
326
this . node = node ;
@@ -341,8 +343,8 @@ export default function sortableContainer(
341
343
this . offsetEdge = getEdgeOffset ( node , this . container ) ;
342
344
this . initialOffset = getPosition ( event ) ;
343
345
this . initialScroll = {
344
- top : this . container . scrollTop ,
345
- left : this . container . scrollLeft ,
346
+ top : this . scrollContainer . scrollTop ,
347
+ left : this . scrollContainer . scrollLeft ,
346
348
} ;
347
349
348
350
this . initialWindowScroll = {
@@ -587,8 +589,8 @@ export default function sortableContainer(
587
589
const { transitionDuration, hideSortableGhost, onSortOver} = this . props ;
588
590
const nodes = this . manager . getOrderedRefs ( ) ;
589
591
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 ,
592
594
} ;
593
595
const sortingOffset = {
594
596
left :
0 commit comments