primefaces / primefaces/primereact
AccordionTab: is being removed from DOM on closing Tab
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 8.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When using the accordion component, the tab is removed from the DOM once it is closed. This could be problematic, for example, when forms and input fields are used as content, as the content of the input field is deleted when closing and reopening. Of course, one could store the content of the field in a useState (as in the example), but the problem with form validation persists because only the fields of the current tab are validated, not all of them. The entire form cannot be validated if there are form fields in the different accordion tabs.
I compared the component with other libraries like PrimeVue and PrimeNG, where the content of the DOM is NOT deleted. Is there a simple way to prevent the accordion tab from being removed from the DOM when the tab is closed?
Reproducer
https://stackblitz.com/edit/rdg6zx-hjxnyv?file=src%2FApp.jsx
PrimeReact version
10.6.4
React version
17.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the AccordionTab behavior shown in the linked StackBlitz reproducer and trace how closing a tab affects its DOM content. Compare the current behavior with the reported PrimeVue and PrimeNG behavior. Done means closed tabs retain their form fields so reopening preserves them and validation can cover fields across tabs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript, vite
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100