Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: NavigationMenu.Item - openOnHover prop #1223

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

huntabyte
Copy link
Owner

@huntabyte huntabyte commented Feb 20, 2025

This PR introduces a new prop to NavigationMenu.Item, openOnHover, which defaults to true (behavior today), to enable users to prevent opening the item's NavigationMenu.Content on hover.

To provide more flexibility, we added it to the individual items instead of the NavigationMenu.Root.

When openOnHover={false}, the menu will no longer close when the pointer leaves the trigger/content and will instead expect a more explicit close event, such as pointer down outside, escape key down, or focus outside.

Closes #1222

@huntabyte huntabyte added the publish:preview Add to PRs to publish preview packages with `pkg-pr-new` label Feb 20, 2025
Copy link

changeset-bot bot commented Feb 20, 2025

🦋 Changeset detected

Latest commit: a6581eb

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

This PR includes changesets to release 1 package
Name Type
bits-ui Minor

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

Copy link

pkg-pr-new bot commented Feb 20, 2025

Open in Stackblitz

npm i https://pkg.pr.new/bits-ui@1223

commit: a6581eb

Copy link
Contributor

github-actions bot commented Feb 20, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
bits-ui ✅ Ready (View Log) Visit Preview a6581eb

@AlexJMohr
Copy link

I think it solves my usecase, in combination with interactOutsideBehavior="ignore" escapeKeydownBehavior="ignore" on NavigationMenu.Content. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
publish:preview Add to PRs to publish preview packages with `pkg-pr-new`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NavigationMenu - add ability to disable hover behaviour
2 participants