@@ -353,6 +353,10 @@ function Sortable(el, options) {
353
353
this . el = el ; // root element
354
354
this . options = options = Object . assign ( { } , options ) ;
355
355
356
+ if ( this . options . fallbackOnBody ) {
357
+ // backwards compatibility
358
+ this . options . getFallbackParent = ( ) => ( document . body )
359
+ }
356
360
357
361
// Export instance
358
362
el [ expando ] = this ;
@@ -390,6 +394,7 @@ function Sortable(el, options) {
390
394
touchStartThreshold : ( Number . parseInt ? Number : window ) . parseInt ( window . devicePixelRatio , 10 ) || 1 ,
391
395
forceFallback : false ,
392
396
fallbackClass : 'sortable-fallback' ,
397
+ getFallbackParent : null ,
393
398
fallbackOnBody : false ,
394
399
fallbackTolerance : 0 ,
395
400
fallbackOffset : { x : 0 , y : 0 } ,
@@ -852,7 +857,8 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
852
857
// Bug if using scale(): https://stackoverflow.com/questions/2637058
853
858
// Not being adjusted for
854
859
if ( ! ghostEl ) {
855
- let container = this . options . fallbackOnBody ? document . body : rootEl ,
860
+ let fallbackParent = typeof this . options . getFallbackParent === 'function' ? this . options . getFallbackParent ( ) : null
861
+ let container = fallbackParent ?? rootEl ,
856
862
rect = getRect ( dragEl , true , PositionGhostAbsolutely , true , container ) ,
857
863
options = this . options ;
858
864
0 commit comments