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

Method resetFocusEffect

src/aria/private/grid/grid.ts:296–311  ·  view source on GitHub ↗

Resets the focus to the active cell element or grid element.

()

Source from the content-addressed store, hash-verified

294
295 /** Resets the focus to the active cell element or grid element. */
296 resetFocusEffect(): void {
297 const stateStale = this._stateStale();
298 if (!stateStale) return;
299
300 const isFocused = untracked(() => this.isFocused());
301 const isRoving = untracked(() => this.inputs.focusMode() === 'roving');
302 const activeCell = untracked(() => this.activeCell());
303
304 if (isRoving && activeCell !== undefined && isFocused) {
305 if (!activeCell.isFocused()) {
306 activeCell.focus();
307 }
308 }
309
310 this._stateStale.set(false);
311 }
312
313 /** Restore focus when a deletion happened. */
314 restoreFocusEffect(): void {

Callers 1

constructorMethod · 0.80

Calls 3

setMethod · 0.80
isFocusedMethod · 0.65
focusMethod · 0.65

Tested by

no test coverage detected