fix(tree-view): make first focusable node tabbable regardless of active/selected states

This commit is contained in:
Eric Y Liu 2021-07-14 09:54:01 -07:00
commit 48d4c0ba37

View file

@ -81,14 +81,12 @@
} }
onMount(() => { onMount(() => {
if ($activeNodeId !== $selectedNodeIds[0]) { const firstFocusableNode = ref.querySelector(
const firstFocusableNode = ref.querySelector( "li.bx--tree-node:not(.bx--tree-node--disabled)"
"li.bx--tree-node:not(.bx--tree-node--disabled)" );
);
if (firstFocusableNode != null) { if (firstFocusableNode != null) {
firstFocusableNode.tabIndex = "0"; firstFocusableNode.tabIndex = "0";
}
} }
}); });