Skip to content

fix(header): don't close the "More" nav menu when clicking a hover-opened trigger - #1089

Merged
JuampiRombola merged 2 commits into
masterfrom
feature/nav-more-hover-click-guard
Aug 21, 2026
Merged

fix(header): don't close the "More" nav menu when clicking a hover-opened trigger#1089
JuampiRombola merged 2 commits into
masterfrom
feature/nav-more-hover-click-guard

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Summary

Radix's NavigationMenu opens on hover but treats a trigger click as a toggle, so hovering "More" in the header (which opens it) and then clicking it immediately closed the menu — reported as a papercut on app.reserve.org.

Fix is local to the header: a small useHoverOpenTrigger() hook whose props are spread onto the More NavigationMenuTrigger. It tracks whether the current open came from a mouse hover and, if so, preventDefault()s the first click — Radix composes trigger handlers with checkForDefaultPrevented, so its onItemSelect toggle is skipped and the menu stays open. A second click still closes it, and touch/keyboard toggling is untouched (pointerType === 'mouse' gate).

onClick: (event) => {
  if (openedByHoverRef.current && event.currentTarget.dataset.state === 'open') {
    openedByHoverRef.current = false
    event.preventDefault() // swallow the toggle-close
  }
}

No change to the shared ui/navigation-menu defaults.

Verification

  • New src/components/layout/header/tests/hover-open-trigger.test.tsx drives the real Radix menu: hover → click stays open, hover → click → click closes, and an unguarded control case reproduces the reported close (fails without the guard).
  • pnpm lint, pnpm typecheck, pnpm test:run green (889 tests).

Link to Devin session: https://app.devin.ai/sessions/42e20ceff5ee44ee94af8556edb2158c

…gger

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 12, 2026

Copy link
Copy Markdown

Deploying register-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7129e70
Status:⚡️  Build in progress...

View logs

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Manual verification — "More" menu hover→click papercut

Tested locally (pnpm start, Vite :3000) in Chrome at desktop width, using real mouse hover/click and keyboard input. Devin session

Primary flow: hover → click keeps the menu open

Hover opens the menu Click on "More" — still open
hover opens click keeps open
Second click closes it (no stuck-open) Item click navigates (/bridge)
second click closes bridge
All assertions (all passed)
  • Hover "More" → menu opens with all 8 items (DTF Explorer, Bridge, Create Yield DTF, Feedback & Requests, Blog, Docs, Forum, Telegram)
  • Click "More" while hover-opened → menu stays open, aria-expanded="true", items still visible/clickable
  • Click "More" again → menu closes, aria-expanded="false"
  • Mouse away after hover-open → closes; hover again → reopens
  • Clicking "Bridge" → /bridge; clicking "DTF Explorer" → /explorer/transactions; menu closes both times
  • Keyboard: focus "More" → Enter opens, Escape closes, Enter opens, second Enter closes (keyboard toggle not swallowed)
  • On /portfolio (page from the bug report): same hover-open / click-stays-open / second-click-closes behavior
  • Regression: Discover DTFs & Portfolio links navigate normally; at <850px the desktop nav is hidden and the hamburger drawer works unchanged

Minor behavioral note (matches Radix defaults, not a regression): after closing with the second click, the menu does not re-open until the pointer leaves and re-enters the trigger.

Regression: narrow-width (<850px) drawer

narrow drawer

@JuampiRombola
JuampiRombola merged commit d004e7a into master Aug 21, 2026
3 of 4 checks passed
@JuampiRombola
JuampiRombola deleted the feature/nav-more-hover-click-guard branch August 21, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants