NavbarCollapse closes when toggling a MegaMenuDropdown on mobile
@sarthak-11231 ya está trabajando en esto.
Desde el 23/9/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- react, tailwindcss, typescript
- Área
- frontend
Línea de trabajo
Comienza con packages/ui/src/components/Navbar/NavbarLink.tsx y reproduce la interacción móvil documentada usando apps/web/examples/megaMenu/megaMenu.fullWidth.tsx. Compara las dos direcciones propuestas para el manejo de eventos con la semántica existente de Navbar y verifica que el interruptor del desplegable ya no contraiga la NavbarCollapse que lo rodea, mientras que los enlaces normales siguen cerrándola.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
- I have searched the Issues to see if this bug has already been reported
- I have tested the latest version
Describe the bug
On mobile, opening a mega menu dropdown immediately closes the navbar menu around it.
NavbarLink closes the collapse on any click:
function handleClick(event: MouseEvent<HTMLAnchorElement>) {
setIsOpen(false);
onClick?.(event);
}
That handler is attached to the rendered element, including when as="span" is used purely as a wrapper. A <MegaMenuDropdownToggle> nested inside it bubbles its click straight into handleClick, so the dropdown opens and the surrounding <NavbarCollapse> collapses in the same click.
This affects the documented markup: megaMenu.fullWidth and the other mega menu examples all nest the toggle in <NavbarLink as="span">.
Steps to reproduce
<MegaMenu>
<NavbarToggle />
<NavbarCollapse>
<NavbarLink as="span">
<MegaMenuDropdownToggle>Company</MegaMenuDropdownToggle>
</NavbarLink>
</NavbarCollapse>
<MegaMenuDropdown className="hidden w-full">
<p>Company content</p>
</MegaMenuDropdown>
</MegaMenu>
- Narrow the viewport so
<NavbarToggle>is visible - Click the navbar toggle to open the menu
- Click "Company"
Current behavior
The dropdown opens, but <NavbarCollapse> gains hidden in the same click, so the menu closes underneath it.
Expected behavior
The navbar menu stays open while a mega menu dropdown is toggled.
Possible directions
Two options, and the choice is a maintainer call since it changes Navbar semantics:
- Have
NavbarLinkskipsetIsOpen(false)when the click originated from a nested interactive element (for example, whenevent.targetis not the link itself). Fixes it centrally and keeps the "tapping a link closes the menu" behaviour intact. - Call
event.stopPropagation()inMegaMenuDropdownToggle. Narrower, but it would also swallow anyonClicka consumer attached to an ancestor, so it seems like the worse trade.
Context
Found while reviewing #1685, which fixes multiple dropdowns in a single mega menu. Verified this reproduces on main at 85319bd independently of that PR, so it is filed separately. Happy to open a PR once there is a preferred direction.
- Lenguaje dominante
- TypeScript
- Estrellas
- 2.1k
- Forks
- 502
- Merge medio
- 19 h 16 min
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de themesberg/flowbite-react
-
fix(Carousel): can't give dynamic children to CarouselPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto:bug: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
themesberg/flowbite-react#1469 · 1 comentario ·
-
Pagination is broken if there is only one pagePosiblemente ocupada @Mukilan1600 la tomó hace 1019 días. Abierto:bug: bug confirmed good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
themesberg/flowbite-react#1048 · 7 comentarios · 1 reacción ·
-
:books: documentation help wanted
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
themesberg/flowbite-react#1696 · 2 comentarios ·
-
Add a QRCode componentAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
themesberg/flowbite-react#1693 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
themesberg/flowbite-react#1677 ·
Todos los issues de themesberg/flowbite-react
Issues similares
-
area: web bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
kinqsradio/orbyn-engineering#227 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
joeldesante/TurfBuilder#258 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
ncecere/open-mcp-portal#85 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
loathers/garbage-collector#2865 ·
Los mantenedores suelen responder en 1 día
-
test-reliability
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Azure/azure-sdk-for-js#40672 · 1 reacción ·
Los mantenedores suelen responder en 1 día