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

Method onFocusOut

src/aria/private/grid/grid.ts:251–270  ·  view source on GitHub ↗

Handles focusout events on the grid.

(event: FocusEvent)

Source from the content-addressed store, hash-verified

249
250 /** Handles focusout events on the grid. */
251 onFocusOut(event: FocusEvent) {
252 // Pass down focusout event to the cell that loses focus.
253 const blurTarget = _getEventTarget<Element>(event);
254 const cell = this.inputs.getCell(blurTarget);
255
256 // Pass down the focusout event to the cell.
257 cell?.onFocusOut(event);
258
259 const focusTarget = event.relatedTarget as Element | null;
260 if (this.inputs.element().contains(focusTarget)) return;
261
262 // If a `relatedTarget`(focusing target) is null, then it can be caused by either
263 // - Clicking on a non-focusable element, or
264 // - The focused element is removed from the page.
265 if (focusTarget === null) {
266 this._maybeDeletion.set(true);
267 }
268
269 this.isFocused.set(false);
270 }
271
272 /** Sets the default active state of the grid before receiving focus the first time. */
273 setDefaultStateEffect(): void {

Callers 1

grid.spec.tsFile · 0.45

Calls 4

_getEventTargetFunction · 0.90
getCellMethod · 0.80
setMethod · 0.80
elementMethod · 0.45

Tested by

no test coverage detected