carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.73k stars 1.79k forks source link

[Bug]: Treeview - opened node do not remain open even when parent is collapsed and then opened again #17221

Open rcsatheeshkumar opened 3 weeks ago

rcsatheeshkumar commented 3 weeks ago

Package

@carbon/react

Browser

Chrome, Safari, Firefox, Edge

Package version

1.63.2

React version

18.2.0

Description

Have my opened nodes remain open even if their parent is collapsed and then opened again. The nodes should remain in the same open or closed state.

Reproduction/example

https://stackblitz.com/edit/github-3xhbda-38shez?file=src%2FApp.jsx,package.json

Steps to reproduce

  1. Expand node "A"
  2. Then collapse it's parent node "One"
  3. Expand node "One" and node "A" would be in collapsed state.

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

guidari commented 3 weeks ago

Hey @rcsatheeshkumar Can you check the storybook code to see if you are missing any configuration. Here in the storybook Default variant works as expected.

p-szalast commented 3 weeks ago

Hey @rcsatheeshkumar Can you check the storybook code to see if you are missing any configuration. Here in the storybook Default variant works as expected.

Hey @guidari. In the link that you provided opening parent node also opens previously collapsed sub nodes:

https://github.com/user-attachments/assets/058c02b0-55c6-45a0-aa48-e53686c8e621

guidari commented 3 weeks ago

You are right. I'll check with the team to understand what is the expected behavior! I guess they should always collapse if the parent node is collapsed like it happens in the UIShell, but I'll confirm that.

rcsatheeshkumar commented 3 weeks ago

You are right. I'll check with the team to understand what is the expected behavior! I guess they should always collapse if the parent node is collapsed like it happens in the UIShell, but I'll confirm that.

I think it is a bug since in the design spec of TreeView (https://github.com/carbon-design-system/carbon/issues/5180) it was mentioned that "opened nodes remain open even if their parent is collapsed and then opened again. The nodes should remain in the same open or closed state."

image

thyhmdo commented 3 weeks ago

I think it could have been implemented differently here. As default, those sub-nodes should be closed. If the user interacts with the sub-nodes, then closing the parent, those sub-nodes stay as they are.

Here is an example:

https://github.com/user-attachments/assets/cbb85bef-840a-42eb-b6cc-1140a0d2423e

jakubkloc commented 1 week ago

Can you estimate when this issue will be resolved?