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

Method close

src/aria/private/menu/menu.ts:839–860  ·  view source on GitHub ↗

Closes the submenu.

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

Source from the content-addressed store, hash-verified

837
838 /** Closes the submenu. */
839 close(opts: {refocus?: boolean} = {}) {
840 this._expanded.set(false);
841
842 if (opts.refocus) {
843 this.inputs.parent()?.listBehavior.goto(this);
844 }
845
846 let menuitems = this.inputs.submenu()?.inputs.items() ?? [];
847
848 while (menuitems.length) {
849 const menuitem = menuitems.pop();
850 menuitem?._expanded.set(false);
851 menuitem?.inputs.parent()?.listBehavior.unfocus();
852 menuitems = menuitems.concat(menuitem?.submenu()?.inputs.items() ?? []);
853
854 const parent = menuitem?.inputs.parent();
855
856 if (parent instanceof MenuPattern) {
857 parent._clearTimeouts();
858 }
859 }
860 }
861
862 /** Handles focusin events for the menu item. */
863 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