Skip to content

Checkbox RAC component #90

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

Merged
merged 16 commits into from
Jun 4, 2025
Merged

Checkbox RAC component #90

merged 16 commits into from
Jun 4, 2025

Conversation

jomcarvajal
Copy link
Contributor

New Checkbox created using RAC component. I did'ny modify the old one in case that could break the experience in other parts. The reason of use RAC Checkbox is to use the RAC context and providers already implemented by them. In this case, without their Checkbox, Tree component is not capable of select/unselect checkboxes correctly.

@jomcarvajal jomcarvajal requested a review from jivey May 30, 2025 21:57
@jivey
Copy link
Member

jivey commented Jun 2, 2025

@jomcarvajal I am hesitant to include another checkbox component, can you expand on what you found regarding them selecting/unselecting in the tree? I think we will need to discuss this some more

@jomcarvajal
Copy link
Contributor Author

@jomcarvajal I am hesitant to include another checkbox component, can you expand on what you found regarding them selecting/unselecting in the tree? I think we will need to discuss this some more

Sure! RAC components work in their own context so all components are ready to work together speaking of a11y features. Now, we can use other Checkbox than the RAC option for sure but that implies several workarounds how I did before. So to be clear with this new checkbox, slot='selection' logic only works using the tree and checkbox from RAC because they have all the setup to do it. This components "understand" each other by default.

@jivey
Copy link
Member

jivey commented Jun 2, 2025

Thanks for the additional info, and what's the difference between the check and selection slots?

@jomcarvajal
Copy link
Contributor Author

Thanks for the additional info, and what's the difference between the check and selection slots?

Hard to say, the just took selection as their binding I guess https://react-spectrum.adobe.com/react-aria/Tree.html#treeitem:~:text=Concepts-,%23,-Tree%20makes%20use

Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we need a RAC checkbox to make the tree work, let's not make this generic, I think we'll get it confused with our other checkbox and that could lead to issues. Let's make a tree component folder and place it there, and call it tree checkbox or something. Let's also share as much css as possible (I see you already moved some into a shared file.)

Copy link
Member

@jivey jivey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little outside of the scope of this change, but can you add a tree selection change handler in the Tree story? Would be good to see it working as an example implementation. Right now nothing gets checked, it just collapses/expands the children.

@jomcarvajal jomcarvajal merged commit c8cd4e6 into main Jun 4, 2025
2 of 3 checks passed
@jomcarvajal jomcarvajal deleted the Checkbox-RAC-component branch June 4, 2025 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants