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

Method collapse

src/aria/private/menu/menu.ts:412–421  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 1

MenuPatternClass · 0.95

Calls 3

parentMethod · 0.80
closeMethod · 0.45
prevMethod · 0.45

Tested by

no test coverage detected