Skip to content

Fix/navbar mega menu mobile - #1694

Open
ashutoshpalhare wants to merge 5 commits into
themesberg:mainfrom
ashutoshpalhare:fix/navbar-mega-menu-mobile
Open

ashutoshpalhare wants to merge 5 commits into
themesberg:mainfrom
ashutoshpalhare:fix/navbar-mega-menu-mobile

Conversation

@ashutoshpalhare

@ashutoshpalhare ashutoshpalhare commented Oct 5, 2026 •

Copy link
Copy Markdown

Summarize the changes made and the motivation behind them.

Reference related issues using # followed by the issue number.

If there are breaking API changes - like adding or removing props, or changing the structure of the theme - describe them, and provide steps to update existing code.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed mobile navigation closing unexpectedly when interacting with interactive elements nested inside a navbar link. The navbar now remains open after clicks on nested links, buttons, form controls, or elements marked as buttons, allowing those interactions to proceed without hiding the navigation. Clicking the navbar link itself continues to close the navigation, preserving its existing behavior.

@vercel

vercel Bot commented Oct 5, 2026

Copy link
Copy Markdown

@ashutoshpalhare is attempting to deploy a commit to the Bergside Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ec38d49

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
flowbite-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 241f9f06-1a99-4335-a47a-91bcfa4c4b76
Commits

Reviewing files that changed from the base of the PR and between d0a260d and ec38d49.

Files selected for processing: 1
  • packages/ui/src/components/Navbar/NavbarLink.tsx
Files skipped from review as they are similar to previous changes: 1
  • packages/ui/src/components/Navbar/NavbarLink.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

NavbarLink now keeps the navbar collapse open when a nested interactive element is clicked. The change adds an interaction test and a patch changeset.

Changes: Navbar click handling

Layer / File(s) Summary
Preserve collapse for nested clicks
packages/ui/src/components/Navbar/NavbarLink.tsx, packages/ui/src/components/Navbar/Navbar.test.tsx, .changeset/quiet-walls-click.md
NavbarLink detects clicks inside nested interactive elements and calls onClick without closing the collapse. The test checks that a nested button click leaves the collapse visible. The changeset records a patch.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to ec38d

The change keeps the mobile navbar open for nested controls without altering ordinary link closing. No merge-blocking issue was identified; merge after normal checks pass.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Fix/navbar mega menu mobile" names the navbar and mobile context, but the changeset fixes a different behavior. The changeset keeps the mobile navbar open when a nested interactive element …
Docstring Coverage Passed Docstring coverage is inconclusive: files from earlier reviews still need to be rechecked within the check's analysis limits. Not blocking.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Fix/navbar mega menu mobile" names the navbar and mobile context, but the changeset fixes a different behavior. The changeset keeps the mobile navbar open when a nested interactive element inside a NavbarLink is clicked. The title does not mention this behavior. It also uses a branch-style format with a slash and no verb describing the fix. The title is partially related to the change: it refers to the navbar on mobile, which is a real part of the change, but it does not name the main point.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SutuSebastian SutuSebastian added the needs-changes Review requested changes - author action needed label Oct 28, 2026
@SutuSebastian

Copy link
Copy Markdown
Collaborator

Format check is red - run prettier and push? Then I'll look.

@rahul05ranjan rahul05ranjan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I traced the click semantics against the full component, and the guard behaves correctly on both sides of the boundary:

  • A plain click on the link itself (or on non-interactive text inside it) still closes the collapse: closest resolves to the link's own anchor, which equals event.currentTarget, so the guard falls through to setIsOpen(false) — no behavior change for the common case.
  • as="span" links: the currentTarget doesn't match the selector at all, so ordinary clicks keep closing exactly as before; only genuinely nested interactive elements keep the menu open. Nice that this works without special-casing the as prop.
  • Keeping onClick?.(event) in the early-return branch is the right call — consumers' handlers still fire whether or not the menu closes.

The new test pins the exact regression (toggle open → click the nested button → collapse still visible), and since handleClick is the component's only close path (bound to onClick, with the open state owned by the parent), that test also proves no other handler re-closes it behind the guard.

Two tiny notes, neither blocking:

  1. The interactive-element selector is a hardcoded list (a, button, input, select, textarea, [role="button"]) — things like label, summary, or [tabindex] elements nested in a link won't keep the menu open. Fine if that's the intended boundary, just noting it's the kind of list that grows one issue at a time.
  2. The changeset file is missing its trailing newline — cosmetic, some tooling is picky about that.

CI on the four code checks (Typecheck, Format, Test, Lint) is green on this head; the two failing checks are the Vercel deploy-authorization steps, which look unrelated to the change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-changes Review requested changes - author action needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants