MCPcopy Create free account
hub / github.com/angular/components / goto

Method goto

src/aria/private/menu/menu.ts:591–606  ·  view source on GitHub ↗

Goes to and optionally focuses the specified menu item.

(item: MenuItemPattern<V>, opts?: {focusElement?: boolean})

Source from the content-addressed store, hash-verified

589
590 /** Goes to and optionally focuses the specified menu item. */
591 goto(item: MenuItemPattern<V>, opts?: {focusElement?: boolean}) {
592 const prevItem = this.inputs.activeItem();
593 this.listBehavior.goto(item, opts);
594
595 if (prevItem?.expanded()) {
596 prevItem?.close();
597 this.inputs.activeItem()?.open();
598 }
599
600 if (item === prevItem) {
601 if (item.expanded() && item.submenu()?.inputs.activeItem()) {
602 item.submenu()?.inputs.activeItem()?.close();
603 item.submenu()?.listBehavior.unfocus();
604 }
605 }
606 }
607
608 /** Focuses the next menu item. */
609 next() {

Callers 6

onClickMethod · 0.95
onMouseOverMethod · 0.95
setDefaultStateMethod · 0.45
onMouseOverMethod · 0.45
onClickMethod · 0.45
closeMethod · 0.45

Calls 5

activeItemMethod · 0.80
expandedMethod · 0.80
openMethod · 0.65
unfocusMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected