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

Method _expandOrFirstChild

src/aria/private/tree/tree.ts:466–473  ·  view source on GitHub ↗

Expands the active item if possible, otherwise navigates to the first child.

(opts?: SelectOptions)

Source from the content-addressed store, hash-verified

464
465 /** Expands the active item if possible, otherwise navigates to the first child. */
466 _expandOrFirstChild(opts?: SelectOptions) {
467 const item = this.treeBehavior.inputs.activeItem();
468 if (item && this.treeBehavior.isExpandable(item) && !item.expanded()) {
469 this.treeBehavior.expand(item);
470 } else {
471 this.treeBehavior.firstChild(opts);
472 }
473 }
474
475 /** Collapses the active item if possible, otherwise navigates to the parent. */
476 _collapseOrParent(opts?: SelectOptions) {

Callers 1

TreePatternClass · 0.95

Calls 5

activeItemMethod · 0.80
expandedMethod · 0.80
firstChildMethod · 0.80
expandMethod · 0.65
isExpandableMethod · 0.45

Tested by

no test coverage detected