@@ -9,6 +9,7 @@ import { UmbArrayState, UmbObjectState } from '@umbraco-cms/backoffice/observabl
99import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
1010import { UmbAncestorsEntityContext , UmbParentEntityContext , type UmbEntityModel } from '@umbraco-cms/backoffice/entity' ;
1111import { linkEntityExpansionEntries } from '@umbraco-cms/backoffice/utils' ;
12+ import { UMB_MODAL_CONTEXT } from '@umbraco-cms/backoffice/modal' ;
1213
1314interface UmbMenuTreeStructureWorkspaceContextBaseArgs {
1415 treeRepositoryAlias : string ;
@@ -33,13 +34,18 @@ export abstract class UmbMenuTreeStructureWorkspaceContextBase extends UmbContex
3334 #parentContext = new UmbParentEntityContext ( this ) ;
3435 #ancestorContext = new UmbAncestorsEntityContext ( this ) ;
3536 #sectionSidebarMenuContext?: typeof UMB_SECTION_SIDEBAR_MENU_SECTION_CONTEXT . TYPE ;
37+ #isModalContext: boolean = false ;
3638
3739 constructor ( host : UmbControllerHost , args : UmbMenuTreeStructureWorkspaceContextBaseArgs ) {
3840 super ( host , UMB_MENU_STRUCTURE_WORKSPACE_CONTEXT ) ;
3941 // 'UmbMenuStructureWorkspaceContext' is Obsolete, will be removed in v.18
4042 this . provideContext ( 'UmbMenuStructureWorkspaceContext' , this ) ;
4143 this . #args = args ;
4244
45+ this . consumeContext ( UMB_MODAL_CONTEXT , ( modalContext ) => {
46+ this . #isModalContext = modalContext !== undefined ;
47+ } ) ;
48+
4349 this . consumeContext ( UMB_SECTION_SIDEBAR_MENU_SECTION_CONTEXT , ( instance ) => {
4450 this . #sectionSidebarMenuContext = instance ;
4551 } ) ;
@@ -109,7 +115,7 @@ export abstract class UmbMenuTreeStructureWorkspaceContextBase extends UmbContex
109115 this . #setAncestorData( data ) ;
110116
111117 const menuItemAlias = this . manifest ?. meta ?. menuItemAlias ;
112- if ( menuItemAlias ) {
118+ if ( menuItemAlias && ! this . #isModalContext ) {
113119 this . #expandSectionSidebarMenu( structureItems , menuItemAlias ) ;
114120 }
115121 }
0 commit comments