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

Method goto

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

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