Skip to content

Commit

Permalink
Fix primefaces#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 f8d1a21
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions components/lib/tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,17 @@ 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 (nodeElement) {
nodeElement.tabIndex = '-1';
}

if (listElement) {
const childElement = listElement.children[0];

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

childFocusEvent.current = null;
}
Expand Down

0 comments on commit f8d1a21

Please sign in to comment.