@@ -49,6 +49,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
49
49
_isFullHeight : { state : true } ,
50
50
_left : { state : true } ,
51
51
_margin : { state : true } ,
52
+ _mobileDropdownShowing : { state : true } ,
52
53
_nestedShowing : { state : true } ,
53
54
_overflowBottom : { state : true } ,
54
55
_overflowTop : { state : true } ,
@@ -67,12 +68,14 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
67
68
this . _autoSize = true ;
68
69
this . _dialogId = getUniqueId ( ) ;
69
70
this . _fullscreenWithin = 0 ;
71
+ this . _handleDropdownOpenClose = this . _handleDropdownOpenClose . bind ( this ) ;
70
72
this . _handleMvcDialogOpen = this . _handleMvcDialogOpen . bind ( this ) ;
71
73
this . _inIframe = false ;
72
74
this . _isFullHeight = false ;
73
75
this . _height = 0 ;
74
76
this . _left = 0 ;
75
77
this . _margin = { top : defaultMargin . top , right : defaultMargin . right , bottom : defaultMargin . bottom , left : defaultMargin . left } ;
78
+ this . _mobileDropdownShowing = false ;
76
79
this . _nestedShowing = false ;
77
80
this . _overflowBottom = false ;
78
81
this . _overflowTop = false ;
@@ -143,6 +146,8 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
143
146
_addHandlers ( ) {
144
147
window . addEventListener ( 'resize' , this . _updateSize ) ;
145
148
this . addEventListener ( 'touchstart' , this . _handleTouchStart ) ;
149
+ this . addEventListener ( 'd2l-dropdown-open' , this . _handleDropdownOpenClose , { capture : true } ) ;
150
+ this . addEventListener ( 'd2l-dropdown-close' , this . _handleDropdownOpenClose , { capture : true } ) ;
146
151
if ( this . shadowRoot ) this . shadowRoot . querySelector ( '.d2l-dialog-content' ) . addEventListener ( 'scroll' , this . _updateOverflow ) ;
147
152
}
148
153
@@ -331,6 +336,10 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
331
336
e . stopPropagation ( ) ;
332
337
}
333
338
339
+ _handleDropdownOpenClose ( e ) {
340
+ this . _mobileDropdownShowing = e . composedPath ( ) [ 0 ] . _useMobileStyling ;
341
+ }
342
+
334
343
_handleFocusTrapEnter ( e ) {
335
344
// ignore focus trap events when the target is another element
336
345
// to prevent infinite focus loops
@@ -449,6 +458,8 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
449
458
_removeHandlers ( ) {
450
459
window . removeEventListener ( 'resize' , this . _updateSize ) ;
451
460
this . removeEventListener ( 'touchstart' , this . _handleTouchStart ) ;
461
+ this . removeEventListener ( 'd2l-dropdown-open' , this . _handleDropdownOpenClose , { capture : true } ) ;
462
+ this . removeEventListener ( 'd2l-dropdown-close' , this . _handleDropdownOpenClose , { capture : true } ) ;
452
463
if ( this . shadowRoot ) this . shadowRoot . querySelector ( '.d2l-dialog-content' ) . removeEventListener ( 'scroll' , this . _updateOverflow ) ;
453
464
}
454
465
@@ -477,7 +488,8 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
477
488
'd2l-dialog-outer-nested-showing' : ! this . _useNative && this . _nestedShowing ,
478
489
'd2l-dialog-outer-scroll' : this . _scroll ,
479
490
'd2l-dialog-fullscreen-mobile' : info . fullscreenMobile ,
480
- 'd2l-dialog-fullscreen-within' : this . _fullscreenWithin !== 0
491
+ 'd2l-dialog-fullscreen-within' : this . _fullscreenWithin !== 0 ,
492
+ 'd2l-dialog-dropdown-mobile' : this . _mobileDropdownShowing
481
493
} ;
482
494
483
495
return html `${ this . _useNative ?
0 commit comments