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 Component: Custom template gives error when trying to close an expanded item using the keyboard #6307

Closed
SondreBlegen opened this issue Apr 5, 2024 · 2 comments · Fixed by #6460
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@SondreBlegen
Copy link

Describe the bug

When using a custom togglerTemplate with the Tree component and using the keyboard you are able to expand an item that contains children, but when trying to close the expanded item you get an error. The issue is present in the documentation as well.

Console error:
framework-4ed89e9640adfb9e.js:1 Uncaught TypeError: Cannot read properties of null (reading 'click')
at V (5894-ffb4bb7601042570.js:1:14484)
at R (5894-ffb4bb7601042570.js:1:13815)
at Object.Oe (framework-4ed89e9640adfb9e.js:1:16878)
at Ae (framework-4ed89e9640adfb9e.js:1:17032)
at framework-4ed89e9640adfb9e.js:1:36932
at Ir (framework-4ed89e9640adfb9e.js:1:37026)
at Ur (framework-4ed89e9640adfb9e.js:1:37441)
at framework-4ed89e9640adfb9e.js:1:42883
at ss (framework-4ed89e9640adfb9e.js:1:106552)
at Le (framework-4ed89e9640adfb9e.js:1:16010)

Reproducer

No response

PrimeReact version

10.6.2

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

Chrome 123

Steps to reproduce the behavior

  1. Go to the documentation page here
  2. Navigate using the keyboard and expand one item using the right arrow when it is active
  3. After it is expanded, use the left arrow to contract it. This will give the error above in the console

Expected behavior

Should be able to contract items in the tree using the keyboard as well

@SondreBlegen SondreBlegen added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 5, 2024
@sja-cslab
Copy link
Contributor

sja-cslab commented Apr 16, 2024

On the template, the Toggler does not have data-pc-section="toggler" set which causes that the element isn't found (DomHandler.findSingle) resulting in null.click().

@melloware
Copy link
Member

@sja-cslab want to submit a PR?

@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 16, 2024
@melloware melloware added this to the 10.6.4 milestone Apr 16, 2024
sja-cslab added a commit to sja-cslab/primereact that referenced this issue Apr 24, 2024
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.

3 participants