Handles focusout events on the grid.
(event: FocusEvent)
| 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 { |
no test coverage detected