unovue / radix-vue

Vue port of Radix UI Primitives. An open-source UI component library for building high-quality, accessible design systems and web apps.
https://radix-vue.com
MIT License
3.75k stars 237 forks source link

[Bug] Tree Component: Inconsistent Parent Node Indeterminate State Behavior #1458

Open lanzosuarez opened 1 week ago

lanzosuarez commented 1 week ago

Discussed in https://github.com/unovue/radix-vue/discussions/1457

Originally posted by **lanzosuarez** November 26, 2024 Hi everyone, I've noticed an inconsistency with the indeterminate state behavior in the Tree component. The issue manifests differently depending on the selection order: ### When selecting a child first: Parent node remains unchecked, doesn't enter indeterminate state ![image](https://github.com/user-attachments/assets/d1b0eb8d-f430-4fea-9647-678082bbe192) ### When selecting parent first, then unselecting a child: Parent correctly enters indeterminate state ![image](https://github.com/user-attachments/assets/8f1c18fc-1672-4310-9e75-8693b8b942c4) Is this intentional? ### Expected Behavior: The parent node should enter indeterminate state in both scenarios when some (but not all) children are selected, regardless of selection order. Has anyone encountered this issue or have insights on how to achieve consistent indeterminate state behavior? Let me know if you need any clarification or additional information about my setup. Here's my code: ``` ```
zernonia commented 8 hours ago

This is intended behavior. However I think we can implement a bubbleSelect props to allow selecting children will set parent item to indeterminate or checked 😁