-
Notifications
You must be signed in to change notification settings - Fork 57
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
accordion group inconsistent callback value #194
Comments
Sorry about that, I can't review the issue right now but thank you for taking the time to produce a reproduction repo. I think only one accordeon tab is supposed to be open at once but I might be wrong though: https://main--ds-gouv.netlify.app/example/component/accordion/
https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/accordeon/ |
I think I understand. In the case of an accordion group, the states of the accordions are dependent on each other. When you click on the second accordion, it closes the first one. This action is performed by the JavaScript in the dsfr, without changing the value in the React component. Therefore, when you click on it again, the value retains its old value, which explains what is logged. |
Yes that is the behaviour i am looking for, should only open an accordion at a time. @ddecrulle resumed it well |
Not quite. While you are correct that the component is currently flawed, the @ddecrulle, since this is your code, would you be open to fixing it? |
Trying to work with an accordion group in controlled mode but having issues getting the right value on the
onExpandedChange
callback.https://stackblitz.com/edit/nextjs-hu1mpy?file=app%2Fpage.tsx
If i click on Accordion 1 then Accordion 2 then Accordion 1 then Accordion 2
i should expect to always have
expanded = true
in theonExpandedChange
callback right?right now it would show
true, true, false, false
is this the expected behaviour ?
Thanks
The text was updated successfully, but these errors were encountered: