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

Accordion defaultActiveIndex #761

Closed
AlvMF1 opened this issue Oct 28, 2016 · 3 comments · Fixed by #763
Closed

Accordion defaultActiveIndex #761

AlvMF1 opened this issue Oct 28, 2016 · 3 comments · Fixed by #763
Assignees
Labels

Comments

@AlvMF1
Copy link

AlvMF1 commented Oct 28, 2016

Steps

http://codepen.io/anon/pen/JRqzQO

Expected Result

state.activeIndex = 1
('what kinds of dogs are there?' active)

Actual Result

state.activeIndex = -1
(none active)

Version

0.56.14

@levithomason
Copy link
Member

Confirmed, bug fix coming.

@AlvMF1
Copy link
Author

AlvMF1 commented Oct 30, 2016

Hey, thanks for the reply.
I see that you have a test for that, but even after I updated to v0.58.0, the bug still persists.
Also, was it supposed to work on the codepen I sent? If so, it isn't working as well.
Thanks.

@levithomason
Copy link
Member

The controlled component pattern only works with the "panels" prop where the Accordion has control over creating the title/content children with the correct "active" prop set.

If you use subcomponents, as in the codepen, then you are responsible for the props on the subcomponents as well. In React there are no implicit parent child relationships. The docs could be more clear on this.

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

Successfully merging a pull request may close this issue.

2 participants