@1771technologies/lytenyte-pro
Version:
Blazingly fast headless React data grid with 100s of features.
15 lines (14 loc) • 477 B
JavaScript
import { isLastTraversableNode } from "@1771technologies/lytenyte-shared";
export function getFocusedNode() {
if (!document.activeElement)
return null;
let current = document.activeElement;
while (current &&
!isLastTraversableNode(current) &&
current.getAttribute("data-ln-tree-node") !== "true") {
current = current.parentElement;
}
if (current?.getAttribute("data-ln-tree-node"))
return current;
return null;
}