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

Method _resetActiveOption

src/material/list/selection-list.ts:466–475  ·  view source on GitHub ↗

* Resets the active option. When the list is disabled, remove all options from to the tab order. * Otherwise, focus the first selected option.

()

Source from the content-addressed store, hash-verified

464 * Otherwise, focus the first selected option.
465 */
466 private _resetActiveOption() {
467 if (this.disabled) {
468 this._setActiveOption(-1);
469 return;
470 }
471
472 const activeItem =
473 this._items.find(item => item.selected && !item.disabled) || this._items.first;
474 this._setActiveOption(activeItem ? this._items.toArray().indexOf(activeItem) : -1);
475 }
476
477 /** Returns whether the focus is currently within the list. */
478 private _containsFocus() {

Callers 3

MatSelectionListClass · 0.95
_setupRovingTabindexMethod · 0.95

Calls 1

_setActiveOptionMethod · 0.95

Tested by

no test coverage detected