@@ -45,13 +45,13 @@ import {Directionality} from '@angular/cdk/bidi';
4545 host : {
4646 'class' : 'ng-menu-trigger' ,
4747 '[attr.tabindex]' : '_pattern.tabIndex()' ,
48- '[attr.aria-haspopup]' : '_pattern. hasPopup()' ,
49- '[attr.aria-expanded]' : '_pattern. expanded()' ,
48+ '[attr.aria-haspopup]' : 'hasPopup()' ,
49+ '[attr.aria-expanded]' : 'expanded()' ,
5050 '[attr.aria-controls]' : '_pattern.menu()?.id()' ,
5151 '(click)' : '_pattern.onClick()' ,
5252 '(keydown)' : '_pattern.onKeydown($event)' ,
5353 '(focusout)' : '_pattern.onFocusOut($event)' ,
54- '(focusin)' : 'onFocusIn()' ,
54+ '(focusin)' : '_pattern. onFocusIn()' ,
5555 } ,
5656} )
5757export class MenuTrigger < V > {
@@ -67,8 +67,11 @@ export class MenuTrigger<V> {
6767 /** The menu associated with the trigger. */
6868 menu = input < Menu < V > | undefined > ( undefined ) ;
6969
70- /** Whether the menu item has been focused. */
71- readonly hasBeenFocused = signal ( false ) ;
70+ /** Whether the menu is expanded. */
71+ readonly expanded = computed ( ( ) => this . _pattern . expanded ( ) ) ;
72+
73+ /** Whether the menu trigger has a popup. */
74+ readonly hasPopup = computed ( ( ) => this . _pattern . hasPopup ( ) ) ;
7275
7376 /** The menu trigger ui pattern instance. */
7477 _pattern : MenuTriggerPattern < V > = new MenuTriggerPattern ( {
@@ -120,7 +123,7 @@ export class MenuTrigger<V> {
120123 'role' : 'menu' ,
121124 'class' : 'ng-menu' ,
122125 '[attr.id]' : '_pattern.id()' ,
123- '[attr.data-visible]' : '_pattern. isVisible()' ,
126+ '[attr.data-visible]' : 'isVisible()' ,
124127 '(keydown)' : '_pattern.onKeydown($event)' ,
125128 '(mouseover)' : '_pattern.onMouseOver($event)' ,
126129 '(mouseout)' : '_pattern.onMouseOut($event)' ,
@@ -181,7 +184,7 @@ export class Menu<V> {
181184 readonly items = ( ) => this . _items ( ) . map ( i => i . _pattern ) ;
182185
183186 /** Whether the menu is visible. */
184- isVisible = computed ( ( ) => this . _pattern . isVisible ( ) ) ;
187+ readonly isVisible = computed ( ( ) => this . _pattern . isVisible ( ) ) ;
185188
186189 /** A callback function triggered when a menu item is selected. */
187190 onSelect = output < V > ( ) ;
@@ -209,7 +212,7 @@ export class Menu<V> {
209212 this . _deferredContentAware ?. contentVisible . set ( true ) ;
210213 } else {
211214 this . _deferredContentAware ?. contentVisible . set (
212- this . _pattern . isVisible ( ) || ! ! this . parent ( ) ?. hasBeenFocused ( ) ,
215+ this . _pattern . isVisible ( ) || ! ! this . parent ( ) ?. _pattern . hasBeenFocused ( ) ,
213216 ) ;
214217 }
215218 } ) ;
@@ -333,11 +336,11 @@ export class MenuBar<V> {
333336 host : {
334337 'role' : 'menuitem' ,
335338 'class' : 'ng-menu-item' ,
336- '(focusin)' : 'onFocusIn()' ,
339+ '(focusin)' : '_pattern. onFocusIn()' ,
337340 '[attr.tabindex]' : '_pattern.tabIndex()' ,
338- '[attr.data-active]' : '_pattern. isActive()' ,
339- '[attr.aria-haspopup]' : '_pattern. hasPopup()' ,
340- '[attr.aria-expanded]' : '_pattern. expanded()' ,
341+ '[attr.data-active]' : 'isActive()' ,
342+ '[attr.aria-haspopup]' : 'hasPopup()' ,
343+ '[attr.aria-expanded]' : 'expanded()' ,
341344 '[attr.aria-disabled]' : '_pattern.disabled()' ,
342345 '[attr.aria-controls]' : '_pattern.submenu()?.id()' ,
343346 } ,
@@ -375,8 +378,14 @@ export class MenuItem<V> {
375378 /** The submenu associated with the menu item. */
376379 readonly submenu = input < Menu < V > | undefined > ( undefined ) ;
377380
378- /** Whether the menu item has been focused. */
379- readonly hasBeenFocused = signal ( false ) ;
381+ /** Whether the menu item is active. */
382+ readonly isActive = computed ( ( ) => this . _pattern . isActive ( ) ) ;
383+
384+ /** Whether the menu is expanded. */
385+ readonly expanded = computed ( ( ) => this . _pattern . expanded ( ) ) ;
386+
387+ /** Whether the menu item has a popup. */
388+ readonly hasPopup = computed ( ( ) => this . _pattern . hasPopup ( ) ) ;
380389
381390 /** The menu item ui pattern instance. */
382391 readonly _pattern : MenuItemPattern < V > = new MenuItemPattern < V > ( {
0 commit comments