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

Method setDefaultState

src/aria/private/toolbar/toolbar.ts:215–223  ·  view source on GitHub ↗

* Sets the toolbar to its default initial state. * * Sets the active index to the selected widget if one exists and is focusable. * Otherwise, sets the active index to the first focusable widget.

()

Source from the content-addressed store, hash-verified

213 * Otherwise, sets the active index to the first focusable widget.
214 */
215 setDefaultState() {
216 const firstItem = this.listBehavior.navigationBehavior.peekFirst({
217 items: this.inputs.items(),
218 });
219
220 if (firstItem) {
221 this.inputs.activeItem.set(firstItem);
222 }
223 }
224
225 /** Sets the default active state of the toolbar before receiving interaction for the first time. */
226 setDefaultStateEffect(): void {

Callers 2

setDefaultStateEffectMethod · 0.95
getPatternsFunction · 0.45

Calls 2

setMethod · 0.80
peekFirstMethod · 0.45

Tested by 1

getPatternsFunction · 0.36