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