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

Method goto

src/aria/private/menu/menu.ts:618–633  ·  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

616
617 /** Goes to and optionally focuses the specified menu item. */
618 goto(item: MenuItemPattern<V>, opts?: {focusElement?: boolean}) {
619 const prevItem = this.inputs.activeItem();
620 this.listBehavior.goto(item, opts);
621
622 if (prevItem?.expanded()) {
623 prevItem?.close();
624 this.inputs.activeItem()?.open();
625 }
626
627 if (item === prevItem) {
628 if (item.expanded() && item.submenu()?.inputs.activeItem()) {
629 item.submenu()?.inputs.activeItem()?.close();
630 item.submenu()?.listBehavior.unfocus();
631 }
632 }
633 }
634
635 /** Focuses the next menu item. */
636 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