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

Method _expandOrFirstChild

src/aria/private/tree/tree.ts:462–469  ·  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

460
461 /** Expands the active item if possible, otherwise navigates to the first child. */
462 _expandOrFirstChild(opts?: SelectOptions) {
463 const item = this.treeBehavior.inputs.activeItem();
464 if (item && this.treeBehavior.isExpandable(item) && !item.expanded()) {
465 this.treeBehavior.expand(item);
466 } else {
467 this.treeBehavior.firstChild(opts);
468 }
469 }
470
471 /** Collapses the active item if possible, otherwise navigates to the parent. */
472 _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