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 : Fix PassThrough Options checkbox #7126

Closed
kyybo opened this issue Sep 6, 2024 · 3 comments · Fixed by #7160 · May be fixed by leoo1992/GeradorQRCode#95
Closed

Tree : Fix PassThrough Options checkbox #7126

kyybo opened this issue Sep 6, 2024 · 3 comments · Fixed by #7160 · May be fixed by leoo1992/GeradorQRCode#95
Labels
Component: Tailwind Tailwind specific issue Typescript Issue or pull request is *only* related to TypeScript definition

Comments

@kyybo
Copy link
Contributor

kyybo commented Sep 6, 2024

Describe the bug

In the Tree component documentation, in the TreePassThroughOptions section, the properties checkbox and checkboxContainer are mentioned.
I tried to get them to work, but without success :
<Tree value={nodes} selectionMode="checkbox" selectionKeys={selectedKeys} onSelectionChange={(e) => setSelectedKeys(e.value)} pt={{ checkbox: { 'aria-label': 'My aria label' } }} />
The checkbox input in DOM doesn't take the aria-label property.

After looking at the code, I noticed that the passtrough checkbox and checkboxContainer options were never used. Instead, the nodeCheckbox option is used, even though it's not mentioned in the documentation.
This can be seen in the file UITreeNode.js on line 750.
image

So I tried using the nodeCheckbox option and it works.
<Tree value={nodes} selectionMode="checkbox" selectionKeys={selectedKeys} onSelectionChange={(e) => setSelectedKeys(e.value)} pt={{ nodeCheckbox: { 'aria-label': 'My aria label' } }} />
Both checkbox input and checkbox container had the aria-label property :
image

So we'd need to either update the documentation or modify the implementation to ensure consistency between the two.

Reproducer

No response

System Information

"primereact": "10.8.2"
"react": "^18.2.0"

Steps to reproduce the behavior

No response

Expected behavior

Either update the documentation or modify the implementation to ensure consistency between the two.

@kyybo kyybo added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Sep 6, 2024
@melloware
Copy link
Member

I think NodeCheckbox etc is correct so if you can submit a PR correcting the docs that would be great.

@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Sep 7, 2024
@Neelabha29
Copy link

Tree Checkbox PT: TreePassThroughOptions is also not working with Tailwind CSS styles
Screenshot 2024-09-11 182507
Screenshot 2024-09-11 182652
Screenshot 2024-09-11 182827

@melloware melloware added the Component: Tailwind Tailwind specific issue label Sep 11, 2024
@kyybo
Copy link
Contributor Author

kyybo commented Sep 11, 2024

Neelabha29 and if you try to use the passtrough option nodeCheckbox instead of checkbox (without worrying about typescript warnings) does it work ?

kyybo added a commit to kyybo/primereact that referenced this issue Sep 11, 2024
* replace the PassThrought options 'checkboxContainer' and 'checkbox'  with 'nodeCheckbox'
melloware pushed a commit that referenced this issue Sep 11, 2024
* replace the PassThrought options 'checkboxContainer' and 'checkbox'  with 'nodeCheckbox'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Tailwind Tailwind specific issue Typescript Issue or pull request is *only* related to TypeScript definition
Projects
None yet
3 participants