@@ -3520,13 +3520,14 @@ export class DateRangePicker extends CalendarBase {
35203520 this . popupObj . hide ( ) ;
35213521 this . popupWrapper = this . createElement ( 'div' , { id : this . element . id + '_popup' , className : ROOT + ' ' + POPUP } ) ;
35223522 this . renderControl ( ) ;
3523+ const appendToElement : HTMLElement = this . getAppendToElement ( ) ;
35233524 this . openEventArgs = {
35243525 popup : this . popupObj || null ,
35253526 cancel : false ,
35263527 date : this . inputElement . value ,
35273528 model : this ,
35283529 event : event ? event : null ,
3529- appendTo : this . isMobile || Browser . isDevice ? this . mobileRangePopupWrap : document . body
3530+ appendTo : this . isMobile || Browser . isDevice ? this . mobileRangePopupWrap : appendToElement
35303531 } ;
35313532 const eventArgs : RangePopupEventArgs = this . openEventArgs ;
35323533 this . trigger ( 'open' , eventArgs , ( eventArgs : RangePopupEventArgs ) => {
@@ -3607,9 +3608,10 @@ export class DateRangePicker extends CalendarBase {
36073608 if ( ! isNullOrUndefined ( this . cssClass ) && this . cssClass . trim ( ) !== '' ) {
36083609 this . popupWrapper . className += ' ' + this . cssClass ;
36093610 }
3611+ const appendToElement : HTMLElement = this . getAppendToElement ( ) ;
36103612 if ( this . isMobile && this . isCustomWindow ) {
36113613 this . modal = this . createElement ( 'div' ) ;
3612- document . body . appendChild ( this . modal ) ;
3614+ appendToElement . appendChild ( this . modal ) ;
36133615 }
36143616 this . popupObj = new Popup ( this . popupWrapper as HTMLElement , {
36153617 relateTo : this . isMobile && this . isCustomWindow ? document . body :
@@ -3742,7 +3744,7 @@ export class DateRangePicker extends CalendarBase {
37423744 }
37433745 if ( this . isMobile && this . isCustomWindow ) {
37443746 addClass ( [ this . modal ] , [ DEVICE , ROOT , 'e-range-modal' ] ) ;
3745- document . body . className += ' ' + OVERFLOW ;
3747+ appendToElement . className += ' ' + OVERFLOW ;
37463748 this . modal . style . display = 'block' ;
37473749 }
37483750 EventHandler . add ( document , 'mousedown touchstart' , this . documentHandler , this ) ;
@@ -4577,6 +4579,16 @@ export class DateRangePicker extends CalendarBase {
45774579 protected getModuleName ( ) : string {
45784580 return 'daterangepicker' ;
45794581 }
4582+ protected getAppendToElement ( ) : HTMLElement {
4583+ if ( this . isAngular ) {
4584+ const cdkPane : HTMLElement = this . element . closest ( '.cdk-overlay-pane' ) as HTMLElement ;
4585+ const popoverEl : HTMLElement = this . element . closest ( '[popover]' ) as HTMLElement ;
4586+ if ( cdkPane && popoverEl ) {
4587+ return cdkPane ;
4588+ }
4589+ }
4590+ return document . body ;
4591+ }
45804592 private updateFloatLabelOverflowWidth ( ) : void {
45814593 const container : HTMLElement = this . inputWrapper . container ;
45824594 const label : HTMLElement = container . querySelector ( '.e-float-text.e-label-bottom' ) ;
@@ -4652,17 +4664,18 @@ export class DateRangePicker extends CalendarBase {
46524664 this . targetElement = element ;
46534665 }
46544666 this . createPopup ( ) ;
4667+ const appendToElement : HTMLElement = this . getAppendToElement ( ) ;
46554668 if ( this . isMobile || Browser . isDevice ) {
46564669 this . mobileRangePopupWrap = this . createElement ( 'div' , { className : 'e-daterangepick-mob-popup-wrap' } ) ;
4657- document . body . appendChild ( this . mobileRangePopupWrap ) ;
4670+ appendToElement . appendChild ( this . mobileRangePopupWrap ) ;
46584671 }
46594672 this . openEventArgs = {
46604673 popup : this . popupObj || null ,
46614674 cancel : false ,
46624675 date : this . inputElement . value ,
46634676 model : this ,
46644677 event : event ? event : null ,
4665- appendTo : this . isMobile || Browser . isDevice ? this . mobileRangePopupWrap : document . body
4678+ appendTo : this . isMobile || Browser . isDevice ? this . mobileRangePopupWrap : appendToElement
46664679 } ;
46674680 const eventArgs : RangePopupEventArgs = this . openEventArgs ;
46684681 this . trigger ( 'open' , eventArgs , ( eventArgs : RangePopupEventArgs ) => {
@@ -4769,7 +4782,8 @@ export class DateRangePicker extends CalendarBase {
47694782 }
47704783 }
47714784 this . targetElement = null ;
4772- removeClass ( [ document . body ] , OVERFLOW ) ;
4785+ const appendToElement : HTMLElement = this . getAppendToElement ( ) ;
4786+ removeClass ( [ appendToElement ] , OVERFLOW ) ;
47734787 EventHandler . remove ( document , 'mousedown touchstart' , this . documentHandler ) ;
47744788 if ( this . isMobile && this . modal ) {
47754789 this . modal . style . display = 'none' ;
0 commit comments