Goes to and optionally focuses the specified menu item.
(item: MenuItemPattern<V>, opts?: {focusElement?: boolean})
| 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() { |
no test coverage detected