@@ -214,6 +214,7 @@ export interface IDropdownMenuOptions extends IBaseDropdownOptions {
214214 actions ?: ReadonlyArray < IAction > ;
215215 actionProvider ?: IActionProvider ;
216216 menuClassName ?: string ;
217+ menuAsChild ?: boolean ; // scope down for #99448
217218}
218219
219220export class DropdownMenu extends BaseDropdown {
@@ -222,6 +223,7 @@ export class DropdownMenu extends BaseDropdown {
222223 private _actions : ReadonlyArray < IAction > = [ ] ;
223224 private actionProvider ?: IActionProvider ;
224225 private menuClassName : string ;
226+ private menuAsChild ?: boolean ;
225227
226228 constructor ( container : HTMLElement , options : IDropdownMenuOptions ) {
227229 super ( container , options ) ;
@@ -230,6 +232,7 @@ export class DropdownMenu extends BaseDropdown {
230232 this . actions = options . actions || [ ] ;
231233 this . actionProvider = options . actionProvider ;
232234 this . menuClassName = options . menuClassName || '' ;
235+ this . menuAsChild = ! ! options . menuAsChild ;
233236 }
234237
235238 set menuOptions ( options : IMenuOptions | undefined ) {
@@ -267,7 +270,7 @@ export class DropdownMenu extends BaseDropdown {
267270 onHide : ( ) => this . onHide ( ) ,
268271 actionRunner : this . menuOptions ? this . menuOptions . actionRunner : undefined ,
269272 anchorAlignment : this . menuOptions ? this . menuOptions . anchorAlignment : AnchorAlignment . LEFT ,
270- anchorAsContainer : true
273+ anchorAsContainer : this . menuAsChild
271274 } ) ;
272275 }
273276
@@ -289,10 +292,11 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
289292 private keybindings ?: ( action : IAction ) => ResolvedKeybinding | undefined ;
290293 private clazz : string | undefined ;
291294 private anchorAlignmentProvider : ( ( ) => AnchorAlignment ) | undefined ;
295+ private menuAsChild ?: boolean ;
292296
293- constructor ( action : IAction , menuActions : ReadonlyArray < IAction > , contextMenuProvider : IContextMenuProvider , actionViewItemProvider : IActionViewItemProvider | undefined , actionRunner : IActionRunner , keybindings : ( ( action : IAction ) => ResolvedKeybinding | undefined ) | undefined , clazz : string | undefined , anchorAlignmentProvider ?: ( ) => AnchorAlignment ) ;
294- constructor ( action : IAction , actionProvider : IActionProvider , contextMenuProvider : IContextMenuProvider , actionViewItemProvider : IActionViewItemProvider | undefined , actionRunner : IActionRunner , keybindings : ( ( action : IAction ) => ResolvedKeybinding ) | undefined , clazz : string | undefined , anchorAlignmentProvider ?: ( ) => AnchorAlignment ) ;
295- constructor ( action : IAction , menuActionsOrProvider : ReadonlyArray < IAction > | IActionProvider , contextMenuProvider : IContextMenuProvider , actionViewItemProvider : IActionViewItemProvider | undefined , actionRunner : IActionRunner , keybindings : ( ( action : IAction ) => ResolvedKeybinding | undefined ) | undefined , clazz : string | undefined , anchorAlignmentProvider ?: ( ) => AnchorAlignment ) {
297+ constructor ( action : IAction , menuActions : ReadonlyArray < IAction > , contextMenuProvider : IContextMenuProvider , actionViewItemProvider : IActionViewItemProvider | undefined , actionRunner : IActionRunner , keybindings : ( ( action : IAction ) => ResolvedKeybinding | undefined ) | undefined , clazz : string | undefined , anchorAlignmentProvider ?: ( ) => AnchorAlignment , menuAsChild ?: boolean ) ;
298+ constructor ( action : IAction , actionProvider : IActionProvider , contextMenuProvider : IContextMenuProvider , actionViewItemProvider : IActionViewItemProvider | undefined , actionRunner : IActionRunner , keybindings : ( ( action : IAction ) => ResolvedKeybinding ) | undefined , clazz : string | undefined , anchorAlignmentProvider ?: ( ) => AnchorAlignment , menuAsChild ?: boolean ) ;
299+ constructor ( action : IAction , menuActionsOrProvider : ReadonlyArray < IAction > | IActionProvider , contextMenuProvider : IContextMenuProvider , actionViewItemProvider : IActionViewItemProvider | undefined , actionRunner : IActionRunner , keybindings : ( ( action : IAction ) => ResolvedKeybinding | undefined ) | undefined , clazz : string | undefined , anchorAlignmentProvider ?: ( ) => AnchorAlignment , menuAsChild ?: boolean ) {
296300 super ( null , action ) ;
297301
298302 this . menuActionsOrProvider = menuActionsOrProvider ;
@@ -302,6 +306,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
302306 this . keybindings = keybindings ;
303307 this . clazz = clazz ;
304308 this . anchorAlignmentProvider = anchorAlignmentProvider ;
309+ this . menuAsChild = menuAsChild ;
305310 }
306311
307312 render ( container : HTMLElement ) : void {
@@ -322,7 +327,8 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
322327
323328 const options : IDropdownMenuOptions = {
324329 contextMenuProvider : this . contextMenuProvider ,
325- labelRenderer : labelRenderer
330+ labelRenderer : labelRenderer ,
331+ menuAsChild : this . menuAsChild
326332 } ;
327333
328334 // Render the DropdownMenu around a simple action to toggle it
0 commit comments