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

Bug: Accordion using dynamic tabs and :multiple="true" keep incorrect tabs expanded when changed #2524

Closed
ched-dev opened this issue May 6, 2022 · 2 comments
Labels
Status: Discussion Issue or pull request needs to be discussed by Core Team

Comments

@ched-dev
Copy link

ched-dev commented May 6, 2022

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

CodeSandbox Case (Bug Reports)
Bug behavior is reproduced at https://codesandbox.io/s/dreamy-architecture-mbej6m?file=/index.html

Current behavior
When I have an Accordion with :multiple="true" using dynamic tabs, the tab will stay open by index instead of keeping state with specific item.

Expected behavior
I expect the accordion to keep items open by the specific item instead of index. This is because if I add a new item, I want each item to keep its state.

Minimal reproduction of the problem with instructions

  1. Expand the first item in the Accordion
  2. Click the Add Tab button
  3. The first tab will remain open even though the item has changed

https://codesandbox.io/s/dreamy-architecture-mbej6m?file=/index.html

Accordion.Bug.mov

What is the motivation / use case for changing the behavior?
We use the Accordion to show a list of events. When a new event occurs, we add the event as a new tab. If a tab was open at a specific index, it will now display it's open state based on it's new index, not the specific item.

Please tell us about your environment:
See codesandbox environment

  • Vue version: 3.X
    Vue@next via unpkg script src

  • PrimeVue version: 3.12.X
    Version 3 via unpkg script src

  • Browser:
    Chrome 100.0.4896.127 Mac OS 12.0.1

@tugcekucukoglu
Copy link
Member

activeIndex can be controlled when a new tab is added. Please check this example

@ched-dev
Copy link
Author

I still think the expected behavior when using :multiple="true" is that open tabs stay open and a new tab can start closed. I know you can add code to make that happen, but the default behavior right now feels like a bug. I shouldn't have to add code to "fix" the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Discussion Issue or pull request needs to be discussed by Core Team
Projects
None yet
Development

No branches or pull requests

2 participants