Skip to content

[Bug] Minor UX suggestion for Top Nav Mega Menu trigger behavior #3121

Closed

Description

@imdreamrunner

Description

[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:

  1. 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.

  2. 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.

Reproduction

Lovable homepage:

Hover + immediate click -> mega menu stays open:

lovable.top.nav.mov

Moonveil AI:

Hover + immediate click -> mega menu blinks

moonvei.AI.mov

XDS Version

@astryxdesign/[email protected]

Environment

No response

Activity

  1. added
    bug
    on Jun 25, 2026
  2. rubyycheung commented on Jun 25, 2026

    @rubyycheung
    Contributor

    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

    )

  3. imdreamrunner commented on Jun 25, 2026

    @imdreamrunner
    ContributorAuthor

    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
    )

    Yes I can work on it

  4. imdreamrunner commented on Jun 25, 2026

    @imdreamrunner
    ContributorAuthor

    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:

    1. Hover the trigger → menu opens.
    2. 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.

  5. rubyycheung commented on Jun 25, 2026

    @rubyycheung
    Contributor

    This is a great analysis! Let's try it out :)

  6. added a commit that references this issue on Jul 28, 2026
    32e7e68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions