(node: FocusableElement)
| 824 | } |
| 825 | |
| 826 | function restoreFocusToElement(node: FocusableElement) { |
| 827 | // Dispatch a custom event that parent elements can intercept to customize focus restoration. |
| 828 | // For example, virtualized collection components reuse DOM elements, so the original element |
| 829 | // might still exist in the DOM but representing a different item. |
| 830 | if (node.dispatchEvent(new CustomEvent(RESTORE_FOCUS_EVENT, {bubbles: true, cancelable: true}))) { |
| 831 | focusElement(node); |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | /** |
| 836 | * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker} |
no test coverage detected