-
-
Notifications
You must be signed in to change notification settings - Fork 176
fix(NavigationMenu): submenu/viewport residual transition issues #1489
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
Conversation
🦋 Changeset detectedLatest commit: da1cb4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses residual transition issues in the navigation menu’s submenus and viewport, adds pointer‐hover logic to close and switch submenu content, and introduces demos and tests for these behaviors.
- Reset
previousValueand viewport size/motion state when menus close to prevent stale animations - Add pointer event handlers (
onpointerenter/onpointermove) to auto‐dismiss submenus when hovering between items - Introduce
mountedstate and<Mounted>binding for the viewport, plus new tests and documentation demos
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/src/tests/navigation-menu/navigation-menu.test.ts | New test verifying submenu item switching on pointer hover |
| packages/bits-ui/src/lib/bits/navigation-menu/navigation-menu.svelte.ts | State resets, pointer event handlers, mounted flag, context updates |
| packages/bits-ui/src/lib/bits/navigation-menu/components/navigation-menu-viewport.svelte | Bind <Mounted> to reset viewport size after unmount |
| docs/src/lib/components/demos/navigation-menu-submenu-demo.svelte | New submenu demo |
| docs/src/lib/components/demos/navigation-menu-no-viewport-demo.svelte | New no-viewport demo |
| docs/src/lib/components/demos/index.ts | Export new demo components |
| docs/content/components/navigation-menu.md | Add submenu and no-viewport examples to docs |
| .changeset/moody-carrots-ring.md | Patch noting non-viewport transition fixes |
| .changeset/dry-bees-yawn.md | Patch noting submenu trigger dismissal fix |
Comments suppressed due to low confidence (3)
packages/bits-ui/src/lib/bits/navigation-menu/navigation-menu.svelte.ts:582
- The new
onpointerenterand correspondingonpointermovelogic inNavigationMenuLinkStateshould be covered by unit or integration tests to verify that submenus close as expected when hovering between items.
onpointerenter: PointerEventHandler<HTMLAnchorElement> = () => {
packages/bits-ui/src/lib/bits/navigation-menu/navigation-menu.svelte.ts:48
- The import
useGraceAreais not used in this file and can be removed to reduce dead code and simplify maintenance.
import { useGraceArea } from "$lib/internal/use-grace-area.svelte.js";
packages/bits-ui/src/lib/bits/navigation-menu/navigation-menu.svelte.ts:592
- [nitpick] For consistency with other event handlers (
onpointerenter,onclick, etc.), annotateonpointermovewithPointerEventHandler<HTMLAnchorElement>.
onpointermove = whenMouse(() => {
This pull request introduces bug fixes and enhancements to the
NavigationMenucomponent in thebits-uilibrary, along with updates to the documentation and demos. The changes address issues with transitions, improve submenu behavior, and add new demo components for better visualization.Bug Fixes:
NavigationMenu).NavigationMenucomponent.Documentation Updates:
navigation-menu.mdto include new demos for submenus and non-viewport transitions, replacing code snippets with interactive previews.New Demo Components:
navigation-menu-no-viewport-demo.svelteto demonstrateNavigationMenutransitions without a viewport.navigation-menu-submenu-demo.svelteto showcase nested submenus with improved interaction.Enhancements to NavigationMenu:
Mountedutility innavigation-menu-viewport.svelteto track mounted state for viewport transitions.NavigationMenuRootStateto resetpreviousValuewhen all menus are closed, preventing unwanted transitions.