Accordion doesn't work when nested in custom component
See original GitHub issueI think the problem is because I am using a custom component inside the Accordion
. If I add the AccordionPanel
directly inside the Accordion, it works well. The custom component does nothing else than to render an AccordionPanel
, but it adds a layer in between and apparently that affects the onChange
.
The idea is that the navigation renders navigation items inside a menu.
// Navigation
<Accordion key={project.id}>
<ProjectNavItem project={project} key={project.id} />
</Accordion>
// ProjectNavItem
return (
<AccordionPanel pad="none" heading={"test"}>
Test Me!
</AccordionPanel>
);
Expected Behavior
The accordion panel should expand.
Actual Behavior
The accordion panel doesn’t expand. Following log appears in the console:
TypeError: onChange is not a function AccordionPanel.js:81
URL, screen shot, or Codepen exhibiting the issue
Steps to Reproduce
- Use an
<Accordion />
inside a<Menu />
- Place a custom component inside the accordion. The custom component renders an
<AccordionPanel />
- Try to expand the accordion.
Your Environment
- Grommet version: 1.10.1
- Browser Name and version: Firefox 60.0b5
- Operating System and version (desktop or mobile): Desktop, Windows 10 1709 16299.309
If you need a Codepen example, I can provide it tomorrow.
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
custom styles not effecting the nested accordion jquery
I am trying to create a custom styled accordion. So far , it works exactly how I need it to work for the...
Read more >Using custom elements - Web Components | MDN
Autonomous custom elements are standalone — they don't inherit from standard HTML elements. You use these on a page by literally writing them ......
Read more >Bricks Builder Tutorial nested accordion - YouTube
The Bricks Builder nested accordion content element makes using dynamic content and implementing custom layouts and styling very easy.
Read more >Accordion · Bootstrap v5.0
This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use...
Read more >Great Software! (Need some help with a nested accordion) - #16 by ...
Should we create a custom component from this? ... base however we have highly styled it so I'm not sure how bootstrap etc...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@eluchsinger closing this issue. Please feel free to re-open if further discussion is needed.
Sorry, I don’t know. I am not using Grommet in my current projects.