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

Method _collapseOrParent

src/aria/private/tree/tree.ts:472–479  ·  view source on GitHub ↗

Collapses the active item if possible, otherwise navigates to the parent.

(opts?: SelectOptions)

Source from the content-addressed store, hash-verified

470
471 /** Collapses the active item if possible, otherwise navigates to the parent. */
472 _collapseOrParent(opts?: SelectOptions) {
473 const item = this.treeBehavior.inputs.activeItem();
474 if (item && this.treeBehavior.isExpandable(item) && item.expanded()) {
475 this.treeBehavior.collapse(item);
476 } else {
477 this.treeBehavior.parent(opts);
478 }
479 }
480
481 /** Retrieves the TreeItemPattern associated with a DOM event, if any. */
482 protected _getItem(event: Event): TreeItemPattern<V> | undefined {

Callers 1

TreePatternClass · 0.95

Calls 5

activeItemMethod · 0.80
expandedMethod · 0.80
parentMethod · 0.80
collapseMethod · 0.65
isExpandableMethod · 0.45

Tested by

no test coverage detected