(target: EventTarget | null)
| 131 | } |
| 132 | |
| 133 | export function isWindowRestoredFocus(target: EventTarget | null): boolean { |
| 134 | if (!(target instanceof Node) || restoredFocusElement === null) { |
| 135 | return false |
| 136 | } |
| 137 | const restored = target === restoredFocusElement || restoredFocusElement.contains(target) |
| 138 | if (!restored) { |
| 139 | // The user focused something else, so this was not a window restore. |
| 140 | scheduleClearRestoredFocus() |
| 141 | return false |
| 142 | } |
| 143 | // Keep the record until the next turn so every tooltip handler for this |
| 144 | // event sees it, including when the browser never fires window focus. |
| 145 | scheduleClearRestoredFocus() |
| 146 | return true |
| 147 | } |
| 148 | |
| 149 | export function shouldOpenOnVisibleFocus(event: Event): boolean { |
| 150 | const { target } = event |
no test coverage detected