feat(core,react,html): add generic menu view navigation#1510
Merged
sampotts merged 12 commits intofeat/menu-react-htmlfrom May 6, 2026
Merged
feat(core,react,html): add generic menu view navigation#1510sampotts merged 12 commits intofeat/menu-react-htmlfrom
sampotts merged 12 commits intofeat/menu-react-htmlfrom
Conversation
Implements PR 3 of the menu system with nested Menu.Root detection and in-place menu view navigation. A nested Menu.Root detects its parent MenuContext and operates as a submenu automatically, while core exposes generic view lifecycle hooks so CSS can choose slide, fade, scale, crossfade, or no animation. - Core/dom: Add NavigationState, push/pop to MenuApi and createMenu(), plus createMenuViewTransition() and syncMenuViewTransition() for generic view enter/exit hooks, root view active/inactive state, focus restoration, and viewport width/height measurement. - React: Add Menu.View and Menu.Back, portal nested Menu.Content into the parent viewport, apply generic data-menu-view attrs plus menu semantics separately, and auto-pop RadioItem selection in submenu context. - HTML: Add <media-menu-view> and <media-menu-back>, support nested <media-menu> via commandfor, apply the same generic menu view attrs in submenu mode, and auto-pop radio selection. - Sandbox/docs/tests: Update React and HTML menu sandboxes to style motion with Tailwind data attrs, document Menu.View as shared-viewport in-place navigation only, and cover generic lifecycle attrs across core, React, and HTML tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6d316e4. Configure here.
This was referenced May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds PR 3 of the menu system: generic in-place menu view navigation for nested
menus across core, React, HTML, and the sandbox examples.
This keeps the public composition model as nested
Menu.Root/ nested<media-menu>, but moves the transition internals away from submenu-specificslide assumptions. Core now exposes generic menu view lifecycle hooks that CSS
can use for slide, fade, scale, crossfade, or no animation.
What changed
createMenuViewTransition(),getMenuViewTransitionAttrs(), andsyncMenuViewTransition().data-menu-view,data-menu-view-state,data-direction,data-starting-style, anddata-ending-style.data-submenu-activewith generic root view state viadata-menu-view-state="inactive".--media-menu-widthand--media-menu-height.Menu.ViewandMenu.Back, with nestedMenu.Contentportaledinto the parent viewport.
<media-menu-view>and<media-menu-back>, with nested<media-menu>linked bycommandfor.Tailwind/CSS data-attribute classes.
Menu.Viewas an in-place shared-viewport view boundary, not a requirement for future
flyout submenus.
Notes
style: in-place view navigation inside a shared viewport.
stays in CSS.
Validation
pnpm -F @videojs/core test src/dom/ui/menu/tests/menu-viewport-transition.test.ts src/dom/ui/menu/tests/create-menu-view-transition.test.ts src/dom/ui/menu/tests/create-menu.test.tspnpm -F @videojs/react test src/ui/menu/tests/menu.test.tsxpnpm -F @videojs/html test src/ui/menu/tests/menu-element.test.tspnpm -F @videojs/core buildpnpm -F @videojs/react buildpnpm -F @videojs/html buildpnpm typecheckpnpm check:workspaceanimation timing.
Note
Medium Risk
Adds a new submenu/navigation state machine with view transitions, focus restoration, and viewport sizing across core/React/HTML; regressions are possible in keyboard handling and menu open/close behavior. Risk is moderate due to broad surface-area changes but remains UI-scoped (no auth/data).
Overview
Enables generic in-place view navigation for nested menus by introducing a shared menu-viewport model (root view + child views) driven by new
data-menu-view*attributes,data-direction, and transition lifecycle hooks.Core
createMenu()now tracks a submenu stack vianavigationInputand exposespush/pop, plus a newcreateMenuViewTransition()andmenu-viewport-transitionto coordinate enter/exit phases, focus restoration, and--media-menu-width/heightsizing during view changes.React and HTML menu implementations adopt this model: React adds
Menu.ViewandMenu.Back, updates nestedMenu.Root/Trigger/Contentto operate in submenu mode (including portaling nested content into the parent viewport) and to pop on selection; HTML adds<media-menu-view>and<media-menu-back>, implementscommandfor-linked submenus, and updates event/escape handling to respectdefaultPrevented. Sandboxes and docs are updated to demonstrate and describe the new navigation pattern.Reviewed by Cursor Bugbot for commit 9e83021. Bugbot is set up for automated code reviews on this repo. Configure here.