Skip to content

feat(DropdownMenu): opt-in openOnHover (hover-to-open, mouse-only, click-coexisting)#316

Merged
I-am-nothing merged 1 commit into
mainfrom
feat/dropdown-hover
Jun 21, 2026
Merged

feat(DropdownMenu): opt-in openOnHover (hover-to-open, mouse-only, click-coexisting)#316
I-am-nothing merged 1 commit into
mainfrom
feat/dropdown-hover

Conversation

@I-am-nothing

Copy link
Copy Markdown
Contributor

What

Adds an opt-in openOnHover?: boolean (default false) to DropdownMenu so a desktop trigger can open on mouse hover in addition to click.

  • Hover open/close layers on top of the existing click toggle via the same openMenu/closeMenu helpers.
  • Pointer handlers attach to the outer container (which wraps both the trigger and the inline menu), so trigger→menu travel never leaves it; a private 150ms close-grace timer bridges the notch/gap and is cleared by every closer (select / Escape / Tab / outside-click) and on unmount.
  • Mouse-only: touch/pen early-return and keep tap-to-toggle.
  • Keyboard, focus, and roles unchanged; bonus a11y: aria-haspopup/aria-expanded/aria-controls added to the trigger.

Backward compatibility

100% — openOnHover defaults to false, both pointer handlers are then undefined (React drops them) and every existing click-only call site renders byte-for-byte as before. No prop changed/removed.

Tests + verification

  • DropdownMenu.test.tsx: 12/12 (5 baseline + 7 new hover: open on mouse pointer-enter, stays open within grace on re-enter, closes after grace, touch no-op, Escape still closes, item click still selects+closes, click toggles a hover-opened menu closed).
  • Full suite green (72 files / 784 tests); tsc --noEmit clean.
  • New OpenOnHover Storybook story (desktop overflow menu).

Release

Patch bump 0.5.12 → 0.5.13 per the pre-1.0 patch-only convention (paired with the release label, per kit release mechanics).

Coupling note

Hover-leave detection relies on the menu rendering inline (no portal); a future portal move would require mirroring the hover handlers onto the menu element.

Follow-up (separate PR)

web-landing header.tsx adopts it by adding openOnHover to only the hamburger/overflow-menu DropdownMenu (not any touch/bottom-nav menu) after bumping to 0.5.13.

🤖 Generated with Claude Code

…ing)

Layer hover open/close on top of the existing click toggle via the same
openMenu/closeMenu helpers. Pointer handlers attach to the outer container so
trigger->menu travel stays inside it; a 150ms private close-grace timer bridges
the gap and is cleared by every closer (select/Escape/Tab/outside-click) plus
unmount. Mouse-only: touch/pen early-return and keep tap-to-toggle. Keyboard,
focus, and roles unchanged; add aria-haspopup/expanded/controls to the trigger.

openOnHover defaults to false, so existing call sites render byte-for-byte as
before (both handlers undefined). Patch bump 0.5.12 -> 0.5.13 per pre-1.0
kit convention (needs the release label on the PR). New Storybook OpenOnHover
story + 7 hover tests added.

COUPLING NOTE: depends on the menu rendering inline (no portal); a future portal
move would require mirroring the hover handlers onto the menu element.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@I-am-nothing I-am-nothing added the release Trigger a version bump on merge label Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Storybook Preview: https://mirrorstack-ai.github.io/web-ui-kit/pr/316/

github-actions Bot added a commit that referenced this pull request Jun 21, 2026
@I-am-nothing I-am-nothing merged commit 97430e5 into main Jun 21, 2026
4 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in MirrorStack Platform Jun 21, 2026
github-actions Bot added a commit that referenced this pull request Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Trigger a version bump on merge

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant