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

Method close

src/aria/private/menu/menu.ts:739–756  ·  view source on GitHub ↗

Closes the menu.

(opts: {refocus?: boolean} = {})

Source from the content-addressed store, hash-verified

737
738 /** Closes the menu. */
739 close(opts: {refocus?: boolean} = {}) {
740 this.expanded.set(false);
741 this.pendingFocus.set(undefined);
742 this.menu()?.listBehavior.unfocus();
743
744 if (opts.refocus) {
745 this.inputs.element()?.focus();
746 }
747
748 let menuitems = this.inputs.menu()?.inputs.items() ?? [];
749
750 while (menuitems.length) {
751 const menuitem = menuitems.pop();
752 menuitem?._expanded.set(false);
753 menuitem?.inputs.parent()?.listBehavior.unfocus();
754 menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);
755 }
756 }
757}
758
759/** The menu item ui pattern class. */

Callers 3

MenuTriggerPatternClass · 0.95
onClickMethod · 0.95
onFocusOutMethod · 0.95

Calls 6

setMethod · 0.80
parentMethod · 0.80
unfocusMethod · 0.65
focusMethod · 0.65
menuMethod · 0.45
elementMethod · 0.45

Tested by

no test coverage detected