NavbarCollapse closes when toggling a MegaMenuDropdown on mobile
@sarthak-11231 がすでに取り組んでいます。
2026年9月23日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 58/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- react, tailwindcss, typescript
- 領域
- frontend
調査の方向性
packages/ui/src/components/Navbar/NavbarLink.tsx から始め、apps/web/examples/megaMenu/megaMenu.fullWidth.tsx を使って、文書化されているモバイル操作を再現します。提案されている2つのイベント処理の方向性を既存の Navbar のセマンティクスと比較し、ドロップダウンのトグルによって周囲の NavbarCollapse が折りたたまれなくなり、通常のリンクでは引き続き閉じることを確認します。
索引モデルが issue の本文から書いたものです。
説明
- 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.
- 主要言語
- TypeScript
- スター
- 2.1k
- フォーク
- 502
- 平均マージ
- 19時間 16分
- マージ済み PR(30日)
- 2
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
themesberg/flowbite-react のほかの issue
-
fix(Carousel): can't give dynamic children to Carousel対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン:bug: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
themesberg/flowbite-react#1469 · コメント 1 件 ·
-
Pagination is broken if there is only one page対応中かも @Mukilan1600 が 1019 日前に担当しました。 オープン:bug: bug confirmed good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
themesberg/flowbite-react#1048 · コメント 7 件 · リアクション 1 件 ·
-
:books: documentation help wanted
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
themesberg/flowbite-react#1696 · コメント 2 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
themesberg/flowbite-react#1693 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
themesberg/flowbite-react#1677 ·
themesberg/flowbite-react の issue をすべて見る
似ている issue
-
unwrapDatabaseError masks real DB errors with TypeError: Cannot convert object to primitive valueオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NEARBuilders/everything-dev#798 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
vercel-labs/durable-harness#53 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: Redesign tab bars ignore clicks on Linux: hidden chat layers keep window drag regions対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
experiência: a doc manda subir para o Micro do Supabase, mas não diz que exige plano pago nem quanto custa対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea/docs area/ui enhancement
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
melgarafael/DeskcommCRM#4098 ·
メンテナーはふだん 1 日以内に返信
-
dependencies platform: ios
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
software-mansion/react-native-executorch#1617 ·
メンテナーはふだん 1 日以内に返信