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

[TreeView] parent/child selectionBehavior #6589

Open
nathanforce opened this issue Jun 20, 2024 · 1 comment
Open

[TreeView] parent/child selectionBehavior #6589

nathanforce opened this issue Jun 20, 2024 · 1 comment
Labels
enhancement New feature or request rsp:TreeView

Comments

@nathanforce
Copy link

Provide a general summary of the feature here

I'm having a hard time implementing parent/child selection behavior in a TreeView. Specifically I'd like to be able to:

  1. select a parent and all of its children by selecting the parent checkbox.
  2. Unselecting a child while siblings are still selected switches the parent to indeterminate
  3. Unselecting the last child unselects the parent
  4. Should onSelectionChange include parent keys? In my case parents are basically just meant for grouping and in my external state I'm only interested in knowing which child items are selected.

🤔 Expected Behavior?

Support intuitive parent/child selection.

😯 Current Behavior

Parents and children feel unrelated

💁 Possible Solution

No response

🔦 Context

I'm building this sort of CheckboxTree, which I suspect is a pretty common usage of Tree.

image

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@LFDanLu
Copy link
Member

LFDanLu commented Jun 21, 2024

We'll be most likely looking to add this behavior to our implementation of RSP TreeView (and by extension RAC Tree) since it is supported by Spectrum Design, but I'm unsure when that work will be slated to be picked up. As for the implementation, I imagine SelectionManager would need to be updated to have a mode where toggling the selection of a node that has children would also select the children. As for onSelectionChange including the parent keys I imagine we would still want to include them for use cases do care about parent key selection as well but maybe that could be changed via a option as well.

@LFDanLu LFDanLu added enhancement New feature or request rsp:TreeView labels Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request rsp:TreeView
Projects
Status: ✏️ To Groom
Development

No branches or pull requests

2 participants