File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 33 < p > You clicked on: {{ selected }}</ p >
44
55 < mat-toolbar >
6- < button matIconButton [matMenuTriggerFor] ="menu " aria-label ="Open basic menu ">
6+ < button matIconButton [matMenuTriggerFor] ="menu " matMenuTriggerOverlayInlined aria-label ="Open basic menu ">
77 < mat-icon > more_vert</ mat-icon >
88 </ button >
99 </ mat-toolbar >
Original file line number Diff line number Diff line change @@ -104,6 +104,11 @@ export abstract class MatMenuTriggerBase implements OnDestroy {
104104 /** Data that will be passed to the menu panel. */
105105 abstract menuData : any ;
106106
107+ /**
108+ * Whether to inline the overlay, instead of using the global overlay container.
109+ */
110+ protected _menuOverlayInlined : boolean ;
111+
107112 /** Whether focus should be restored when the menu is closed. */
108113 abstract restoreFocus : boolean ;
109114
@@ -367,6 +372,7 @@ export abstract class MatMenuTriggerBase implements OnDestroy {
367372 scrollStrategy : this . _scrollStrategy ( ) ,
368373 direction : this . _dir || 'ltr' ,
369374 disableAnimations : this . _animationsDisabled ,
375+ insertOverlayAfter : this . _menuOverlayInlined ? this . _element : undefined ,
370376 } ) ;
371377 }
372378
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
1717 OnDestroy ,
1818 Output ,
1919 Renderer2 ,
20+ booleanAttribute ,
2021} from '@angular/core' ;
2122import { OverlayRef } from '@angular/cdk/overlay' ;
2223import { Subscription } from 'rxjs' ;
@@ -67,6 +68,17 @@ export class MatMenuTrigger extends MatMenuTriggerBase implements AfterContentIn
6768 @Input ( 'matMenuTriggerData' )
6869 override menuData : any ;
6970
71+ /**
72+ * Whether to inline the overlay, instead of using the global overlay container.
73+ */
74+ @Input ( { alias : 'matMenuTriggerOverlayInlined' , transform : booleanAttribute } )
75+ get menuOverlayInlined ( ) : boolean {
76+ return this . _menuOverlayInlined ;
77+ }
78+ set menuOverlayInlined ( menuOverlayInlined : boolean ) {
79+ this . _menuOverlayInlined = menuOverlayInlined ;
80+ }
81+
7082 /**
7183 * Whether focus should be restored when the menu is closed.
7284 * Note that disabling this option can have accessibility implications
You can’t perform that action at this time.
0 commit comments