Skip to content

Commit

Permalink
Fix #6049: Tree lazy mode crash on arrow right
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Feb 28, 2024
1 parent a2a2f11 commit b5a20e0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions components/lib/tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,19 @@ export const Tree = React.memo(
const event = childFocusEvent.current;
const nodeElement = event.target.getAttribute('data-pc-section') === 'toggler' ? event.target.closest('[role="treeitem"]') : event.target;
const listElement = nodeElement.children[1];
const childElement = listElement.children[0];

nodeElement.tabIndex = '-1';
childElement.tabIndex = '0';
childElement.focus();
if (listElement) {
if (nodeElement) {
nodeElement.tabIndex = '-1';
}

const childElement = listElement.children[0];

if (childElement) {
childElement.tabIndex = '0';
childElement.focus();
}
}

childFocusEvent.current = null;
}
Expand Down

0 comments on commit b5a20e0

Please sign in to comment.