themesberg / themesberg/flowbite

Mega Menu - Follows Collapse-like behaviour, when I would expect Accordion-like behaviour

Open
#264 7 comments 2 reactions 1 assignee View on GitHub

@zoltanszogyenyi is already working on this.

Since Sep 12, 2022.

bug v1.6.3
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:

  1. Load up an instance of https://flowbite.com/blocks/marketing/header/#header-with-mega-menu
  2. Add a second dropdown button to the menu, targeting a second mega-menu with a unique ID
  3. Click the first, then the second dropdown buttons.
  4. 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.
image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.