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

Method close

src/aria/private/menu/menu.ts:847–868  ·  view source on GitHub ↗

Closes the submenu.

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

Source from the content-addressed store, hash-verified

845
846 /** Closes the submenu. */
847 close(opts: {refocus?: boolean} = {}) {
848 this._expanded.set(false);
849
850 if (opts.refocus) {
851 this.inputs.parent()?.listBehavior.goto(this);
852 }
853
854 let menuitems = this.inputs.submenu()?.inputs.items() ?? [];
855
856 while (menuitems.length) {
857 const menuitem = menuitems.pop();
858 menuitem?._expanded.set(false);
859 menuitem?.inputs.parent()?.listBehavior.unfocus();
860 menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);
861
862 const parent = menuitem?.inputs.parent();
863
864 if (parent instanceof MenuPattern) {
865 parent._clearTimeouts();
866 }
867 }
868 }
869
870 /** Handles focusin events for the menu item. */
871 onFocusIn() {

Callers

nothing calls this directly

Calls 5

setMethod · 0.80
parentMethod · 0.80
_clearTimeoutsMethod · 0.80
unfocusMethod · 0.65
gotoMethod · 0.45

Tested by

no test coverage detected