You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Minor UX suggestion for Top Nav Mega Menu trigger behavior #3121
[Bug] Minor UX suggestion for Top Nav Mega Menu trigger behavior
The top navigation mega menu currently supports both hover and click as triggers.
While both interaction patterns are common individually, supporting both at the same time can lead to an unintuitive experience. For example, when testing the Moonveil AI website with Astryx, my instinct was to click the Services navigation item. However, because the menu had already opened on hover, my click immediately closed it instead.
A couple of ideas that could make this interaction feel more natural:
Delay enabling the click-to-close behavior.
Add a short delay before the trigger element can close an already-open mega menu. The Lovable homepage appears to follow a similar approach—if you hover over a menu item and immediately click it, the menu remains open instead of closing.
Support an "open-only" trigger mode.
Provide an option to configure the top-level navigation item as an open-only trigger. In this mode, clicking the trigger would only open the mega menu, while dismissal would happen only when the user hovers away (or via another configured dismiss behavior).
This would reduce accidental dismissals for users whose natural interaction is to click a navigation item after hovering over it.
Ohhh i see it now! For this instance where their top nav item doesn't lead anywhere, i agree it should stay when clicked on. But if it does lead to another page, it wouldn't be persistent. Do you have time to add this difference into our nav?
Ohhh i see it now! For this instance where their top nav item doesn't lead anywhere, i agree it should stay when clicked on. But if it does lead to another page, it wouldn't be persistent. Do you have time to add this difference into our nav?
I did a case study of Vercel.com; their approach is similar to Option 1.
Vercel top-nav mega-menu: the 500 ms click guard
A small but clever detail in the vercel.com "Products" dropdown that resolves the classic
hover-vs-click conflict.
The problem
On a mouse, opening a menu by hover and then clicking is one fluid gesture. But a naive toggle
breaks it:
Hover the trigger → menu opens.
You click (as people naturally do) → toggle sees "already open" → closes it.
Result: the menu flickers shut on the very click that was supposed to confirm it. Bad.
The fix: a 500 ms guard
The menu records when a hover opened it, and a click on an already-open panel only closes it
if that open is "old" (> 500 ms). Otherwise the click is swallowed and the menu stays put.
openedAt = 0 // timestamp, set ONLY when a hover opens the panel
onHoverIntent(id): // ~80ms after hover
openedAt = now()
activePanel = id
onClick(id): // toggle
if activePanel != id:
activePanel = id // open a different/closed panel
else if now() - openedAt < 500:
// ignore — this is the click that naturally follows a hover-open
else:
openedAt = 0
activePanel = null // genuine click-to-close
Why it doesn't hurt touch
openedAt is set only by hover-intent. Touch has no hover, so on a tap openedAt stays 0, now() - 0 is always > 500, and taps toggle open/close cleanly. The guard fires exactly where the
conflict exists (mouse) and nowhere else.
Keyboard is handled differently
Keyboard activation does not go through the click/toggle path at all:
onKeyDown(Enter | Space) on a trigger:
preventDefault() // cancels the browser's synthetic click -> no toggle, no 500ms guard
open(id) // always OPENS (never toggles closed)
focusFirstLinkInPanel()
onKeyDown(Escape):
close()
returnFocusToTrigger()
So: mouse → toggle (with the 500 ms guard); keyboard → always-open + move focus inside, Escape to
close. Keyboard users get a predictable open/focus model instead of a toggle, which is the correct
accessible behavior.
Activity
rubyycheung commentedon Jun 25, 2026
Ohhh i see it now! For this instance where their top nav item doesn't lead anywhere, i agree it should stay when clicked on. But if it does lead to another page, it wouldn't be persistent. Do you have time to add this difference into our nav?
Gogole.fi.mov
)
imdreamrunner commentedon Jun 25, 2026
Yes I can work on it
imdreamrunner commentedon Jun 25, 2026
I did a case study of Vercel.com; their approach is similar to Option 1.
Vercel top-nav mega-menu: the 500 ms click guard
A small but clever detail in the vercel.com "Products" dropdown that resolves the classic
hover-vs-click conflict.
The problem
On a mouse, opening a menu by hover and then clicking is one fluid gesture. But a naive toggle
breaks it:
Result: the menu flickers shut on the very click that was supposed to confirm it. Bad.
The fix: a 500 ms guard
The menu records when a hover opened it, and a click on an already-open panel only closes it
if that open is "old" (> 500 ms). Otherwise the click is swallowed and the menu stays put.
Why it doesn't hurt touch
openedAtis set only by hover-intent. Touch has no hover, so on a tapopenedAtstays0,now() - 0is always > 500, and taps toggle open/close cleanly. The guard fires exactly where theconflict exists (mouse) and nowhere else.
Keyboard is handled differently
Keyboard activation does not go through the click/toggle path at all:
So: mouse → toggle (with the 500 ms guard); keyboard → always-open + move focus inside, Escape to
close. Keyboard users get a predictable open/focus model instead of a toggle, which is the correct
accessible behavior.
rubyycheung commentedon Jun 25, 2026
This is a great analysis! Let's try it out :)
fix(top-nav): ignore trigger click immediately after hover-open
refactor(core): extract TopNavMegaMenu hover/click logic into useHove…
fix(core): keep TopNavMegaMenu open after hover-click (#3121)
fix(core): keep TopNavMegaMenu open after hover-click (#3121)
fix(core): TopNavMegaMenu hover-then-click no longer dismisses the pa…
fix(hooks): let a pointer-only consumer keep its own focus and toggle
fix(core): consolidate the hover→click guard into useMenuHover (#3121) (
fix(hooks): let a pointer-only consumer keep its own focus and toggle