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

Method collapse

src/aria/private/menu/menu.ts:415–424  ·  view source on GitHub ↗

Collapses the current menu or focuses the previous item in the menubar.

()

Source from the content-addressed store, hash-verified

413
414 /** Collapses the current menu or focuses the previous item in the menubar. */
415 collapse() {
416 const root = this.root();
417 const parent = this.inputs.parent();
418
419 if (parent instanceof MenuItemPattern && !(parent.inputs.parent() instanceof MenuBarPattern)) {
420 parent.close({refocus: true});
421 } else if (root instanceof MenuBarPattern) {
422 root.prev();
423 }
424 }
425
426 /** Expands the current menu or focuses the next item in the menubar. */
427 expand() {

Callers 1

MenuPatternClass · 0.95

Calls 3

parentMethod · 0.80
closeMethod · 0.45
prevMethod · 0.45

Tested by

no test coverage detected