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: Retain expanded/collapsed state #1540

Open
silvalaura opened this issue Nov 8, 2024 · 0 comments
Open

TreeView: Retain expanded/collapsed state #1540

silvalaura opened this issue Nov 8, 2024 · 0 comments
Milestone

Comments

@silvalaura
Copy link
Collaborator

Describe the bug
We should improve how TreeView retains the collapsed/expanded state of each item

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to https://storybook-preview-dev--upbeat-sinoussi-f675aa.netlify.app/?path=/story/treeview--complex&args=preselectedItems[0]:!undefined;preselectedItems[1]:!undefined;preselectedItems[2]:!undefined;preselectedItems[3]:!undefined;preselectedItems[4]:!undefined;preselectedItems[5]:!undefined;preselectedItems[6]:!undefined
  2. Expand Chapter 3: Pudding
  3. Collapse Part 1: Introduction, then expand it
  4. Notice that Chapter 3 is collapsed
  5. Now, collapse Chapter 5: Wafer
  6. Collapse Part 2: Candy powder, then expand it again
  7. Notice that Chapter 5: Wafer is expanded

In this example,
initialExpandedItems : [0 : "pt1"1 : "pt1ch1"2 : "pt2ch5.1"]

So it's trying to maintain the state based on the initialExpanded instead of latest state

Expected behavior
We expect it to remember the state it was in before I collapsed the parent, regardless of what it was set to when the page loaded.

So in the example above, Chapter 3 should still be open. Then, Chapter 5 should be collapsed. At least until the whole page is refreshed or something like that.

Additional context
This shows a good example of the expected behavior: https://vuetifyjs.com/en/components/treeview/#open-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Do
Development

No branches or pull requests

1 participant