Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree: Can't switch between nodes with arrow up and arrow down keys if drag feature is enabled #3004

Closed
zamanapavel opened this issue Jun 22, 2022 · 1 comment · Fixed by #3005
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@zamanapavel
Copy link

Describe the bug

If drag feature is enabled, can't switch with arrow up and arrow down keys.
Looks like p-treenode-droppoint element is focused in this case, and error occurs

Uncaught TypeError: Cannot read properties of undefined (reading 'focus')
at UITreeNode.focusNode (tree.esm.js:355:1)
at UITreeNode.focusNode (react-hot-loader.development.js:717:1)
at UITreeNode.onNodeKeyDown (tree.esm.js:270:1)
at UITreeNode.onNodeKeyDown (react-hot-loader.development.js:717:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:3945:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:3994:1)
at invokeGuardedCallback (react-dom.development.js:4056:1)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4070:1)
at executeDispatch (react-dom.development.js:8243:1)
at processDispatchQueueItemsInOrder (react-dom.development.js:8275:1)

Reproducer

No response

PrimeReact version

8.1.0

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

User can select next/previous node by pressing down arrow/up arrow key

@zamanapavel zamanapavel added Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Jun 22, 2022
@melloware melloware added 👍 confirmed and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 22, 2022
@melloware melloware self-assigned this Jun 22, 2022
@melloware melloware added this to the 8.2.0 milestone Jun 22, 2022
melloware added a commit to melloware/primereact that referenced this issue Jun 22, 2022
@melloware
Copy link
Member

melloware commented Jun 22, 2022

Thanks for reporting. When drag drop is enabled nextSibling is a p-treenode-droppoint not a p-treenode so we need to keep looping over siblings until we run out or find the next node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants