question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Accordion doesn't work when nested in custom component

See original GitHub issue

I 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

image

Steps to Reproduce

  1. Use an <Accordion /> inside a <Menu />
  2. Place a custom component inside the accordion. The custom component renders an <AccordionPanel />
  3. 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:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeWalrathcommented, Mar 8, 2019

@eluchsinger closing this issue. Please feel free to re-open if further discussion is needed.

0reactions
eluchsingercommented, Mar 11, 2019

Sorry, I don’t know. I am not using Grommet in my current projects.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found