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

Method resetFocusEffect

src/aria/private/grid/grid.ts:295–310  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 1

constructorMethod · 0.80

Calls 3

setMethod · 0.80
isFocusedMethod · 0.65
focusMethod · 0.65

Tested by

no test coverage detected