Sign up (with export icon)

utils/dom/getactiveelement

Api-module iconmodule

Functions

  • Chevron-right icon

    getActiveElement( node ) → Element | null

    Returns the focused element in the tree the given node lives in.

    The shadow-aware replacement for document.activeElement, which reports the host of a shadow tree rather than the focused element inside it. Pass any node from the tree whose focus is in question – typically the element being checked itself. Works for open and closed roots alike.

    Parameters

    node: Node

    The node whose tree's active element should be returned.

    Returns

    Element | null