(node: FocusableElement)
| 878 | } |
| 879 | |
| 880 | function restoreFocusToElement(node: FocusableElement) { |
| 881 | // Dispatch a custom event that parent elements can intercept to customize focus restoration. |
| 882 | // For example, virtualized collection components reuse DOM elements, so the original element |
| 883 | // might still exist in the DOM but representing a different item. |
| 884 | if (node.dispatchEvent(new CustomEvent(RESTORE_FOCUS_EVENT, {bubbles: true, cancelable: true}))) { |
| 885 | focusElement(node); |
| 886 | } |
| 887 | } |
| 888 | |
| 889 | /** |
| 890 | * Create a [TreeWalker]{@link https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker} |
no test coverage detected