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

Method _resetActiveOption

src/material/list/selection-list.ts:482–493  ·  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

480 * Otherwise, focus the first selected option.
481 */
482 private _resetActiveOption() {
483 if (this.disabled) {
484 const activeItem = this._items.find(item => item.selected) || this._items.first;
485 const index = activeItem ? this._items.toArray().indexOf(activeItem) : -1;
486 this._setActiveOption(index);
487 return;
488 }
489
490 const activeItem =
491 this._items.find(item => item.selected && !item.disabled) || this._items.first;
492 this._setActiveOption(activeItem ? this._items.toArray().indexOf(activeItem) : -1);
493 }
494
495 /** Returns whether the focus is currently within the list. */
496 private _containsFocus() {

Callers 3

MatSelectionListClass · 0.95
_setupRovingTabindexMethod · 0.95

Calls 1

_setActiveOptionMethod · 0.95

Tested by

no test coverage detected