Skip to content

Type Editor


Type Editor / @type-editor/dom-util / deep-active-element

deep-active-element

Functions

FunctionDescription

deepActiveElement

Gets the deeply nested active element, traversing through Shadow DOM boundaries.

This function recursively descends into shadow roots to find the actual focused element, even when it's nested within multiple levels of Shadow DOM.

Example

typescript
const focusedElement = deepActiveElement(document);
if (focusedElement) {
  console.log("Actually focused element:", focusedElement);
}