Skip to content

[dev-v5] feat: 🌲 TreeView: Support Recursive and Indeterminate Selection in Multiple Selection Mode #3817

Open
@AClerbois

Description

@AClerbois

🙋 Feature Request

When the Multiple Selection mode is activated in the TreeView component, selecting a parent node should recursively select its child nodes and reflect the children's state in the parent's checkbox.

🤔 Expected Behavior

Selecting (checking) a parent node automatically selects all its child nodes recursively.

A parent node becomes checked if all its child nodes are selected.

A parent node becomes indeterminate if only some of its child nodes are selected.

😯 Current Behavior

Currently, selecting a parent node does not automatically select its child nodes. Additionally, parent nodes do not visually reflect the selection state of their children.

💁 Possible Solution

Implement recursive selection logic:

On parent node selection, propagate the selection to all child nodes.

On selection change of a child node, update parent nodes to reflect checked or indeterminate states based on child selections.

🔦 Context

The current behavior can be confusing for users as it does not align with common UI practices for hierarchical selection. Providing recursive and reflective selections improves intuitiveness and usability.

💻 Examples

Example scenario:

✅ Parent Node (checked)
....✅ Child Node 1
....✅ Child Node 2

➖ Parent Node (indeterminate)
.... ✅ Child Node 1
.... ☐ Child Node 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    v5For the next major version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions