Skip to content

Commit

Permalink
Fix #3004: Tree arrow keys with dragdrop enabled (#3005)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jul 1, 2022
1 parent 156255b commit 9226b89
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions components/lib/tree/UITreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,14 @@ export const UITreeNode = React.memo((props) => {
focusNode(listElement.children[0]);
}
else {
const nextNodeElement = nodeElement.nextElementSibling;
let nextNodeElement = nodeElement.nextElementSibling;
while (nextNodeElement) {
if (!DomHandler.hasClass(nextNodeElement, 'p-treenode-droppoint')) {
break;
}
nextNodeElement = nextNodeElement.nextElementSibling;
}

if (nextNodeElement) {
focusNode(nextNodeElement);
}
Expand Down Expand Up @@ -159,7 +166,7 @@ export const UITreeNode = React.memo((props) => {
}

const focusNode = (element) => {
element.children[0].focus();
element && element.children[0] && element.children[0].focus();
}

const onClick = (event) => {
Expand Down

0 comments on commit 9226b89

Please sign in to comment.