@@ -353,6 +353,10 @@ function Sortable(el, options) {
353353 this . el = el ; // root element
354354 this . options = options = Object . assign ( { } , options ) ;
355355
356+ if ( this . options . fallbackOnBody ) {
357+ // backwards compatibility
358+ this . options . getFallbackParent = ( ) => ( document . body )
359+ }
356360
357361 // Export instance
358362 el [ expando ] = this ;
@@ -390,6 +394,7 @@ function Sortable(el, options) {
390394 touchStartThreshold : ( Number . parseInt ? Number : window ) . parseInt ( window . devicePixelRatio , 10 ) || 1 ,
391395 forceFallback : false ,
392396 fallbackClass : 'sortable-fallback' ,
397+ getFallbackParent : null ,
393398 fallbackOnBody : false ,
394399 fallbackTolerance : 0 ,
395400 fallbackOffset : { x : 0 , y : 0 } ,
@@ -852,7 +857,8 @@ Sortable.prototype = /** @lends Sortable.prototype */ {
852857 // Bug if using scale(): https://stackoverflow.com/questions/2637058
853858 // Not being adjusted for
854859 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 ,
856862 rect = getRect ( dragEl , true , PositionGhostAbsolutely , true , container ) ,
857863 options = this . options ;
858864
0 commit comments