themesberg / themesberg/flowbite
Mega Menu - Follows Collapse-like behaviour, when I would expect Accordion-like behaviour
@zoltanszogyenyi is already working on this.
Since Sep 12, 2022.
- Dominant language
- HTML
- Stars
- 9.4k
- Forks
- 862
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
When using the mega-menu component or block, there is no support in the code for closing one mega-menu when another is opened. I would expect the mega-menu to have an accordion-like behaviour. Currently this isn't visible in the example, because only one menu-item in the example has a dropdown button.
To Reproduce
Steps to reproduce the behaviour:
- Load up an instance of https://flowbite.com/blocks/marketing/header/#header-with-mega-menu
- Add a second dropdown button to the menu, targeting a second mega-menu with a unique ID
- Click the first, then the second dropdown buttons.
- Both mega-menus will appear at the same time
Expected behavior
A clear and concise description of what you expected to happen.
- When both dropdown buttons are clicked, the mega-menu should follow an accordion-like behaviour and close any currently open menus within data-accordion="collapse" or similarly attributed ancestor element.
Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):
- OS: Windows 10
- Browser Chrome
- Version 104.0.5112.102 (Official Build) (64-bit)
Additional context
- I think I can workaround this using the code for the accordion component, but thought it would be helpful to flag to save time when implementing in future.
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.
Assessment
This issue has not been assessed yet.