Blame view

天文台pc/tianwentai-ui/node_modules/@mui/utils/getActiveElement/getActiveElement.d.ts 805 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
  /**
   * Gets the actual active element, traversing through shadow roots if necessary.
   *
   * When an element inside a shadow root has focus, `document.activeElement` returns
   * the shadow host element. This function recursively traverses shadow roots to find
   * the actual focused element.
   *
   * @param root - The document or shadow root to start the search from.
   * @returns The actual focused element, or null if no element has focus.
   *
   * @example
   * // In a shadow DOM context
   * const activeElement = getActiveElement(document);
   * // Returns the actual focused element inside the shadow root
   *
   * @example
   * // Starting from a specific document
   * const activeElement = getActiveElement(ownerDocument(element));
   */
  export default function activeElement(doc: Document | ShadowRoot): Element | null;