feat(Breadcrumbs): menu-trigger breadcrumb item reusing the DropdownMenu item API (#4159)#4198
Draft
cixzhang wants to merge 1 commit into
Draft
feat(Breadcrumbs): menu-trigger breadcrumb item reusing the DropdownMenu item API (#4159)#4198cixzhang wants to merge 1 commit into
cixzhang wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
July 22, 2026 12:07
Contributor
Author
Self-review — Quick Self-Review (updating an existing component)
Key protocol principles
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBreadcrumbs · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
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.
What
Adds a
menucapability to the existingBreadcrumbItem. When set, the crumb renders as a link-styled menu trigger (a<button>with a trailing chevron andaria-haspopup="menu") whose popover is arole="menu"container of sibling destinations.Composed children work too (
menu={<><BreadcrumbMenuItem .../></>}).Why — reuse the DropdownMenu item API
The
menuitems are the exact DropdownMenu item API, so a consumer's existing menu-item definitions are portable across DropdownMenu / MoreMenu / ContextMenu / Breadcrumb with no rewrite. This is the same reuseContextMenualready ships, so the breadcrumb menu joins that family rather than inventing a breadcrumb-specific item vocabulary.Reuse (which imports):
renderDropdownItems— converts aDropdownMenuOption[]to items (array form).DropdownMenuContext/DropdownMenuContextValue— providescloseMenu+menuSizeso items (including selectable ones) coordinate and close on select.MENU_ITEM_ROLES/MENU_ITEM_SELECTOR— shared roving-focus/typeahead selector.useListFocus(+useTypeahead) — keyboard navigation over the container.Breadcrumb*aliases (mirroringContextMenu/index.ts).The trigger stays breadcrumb-side: the existing link-styled
<button>path +usePopover+ chevron. This follows the ContextMenu precedent (strategy b) — a thin breadcrumb-siderole="menu"container consuming the public DropdownMenu items/context. No changes toDropdownMenu; extracting a shared container (strategy a) is a tracked follow-up.Trigger / container wiring
usePopover({role: 'none', hasCloseButton: false, hasAutoFocus: false})so the popup's ownrole="menu"is the exposed semantics.popover.triggerProps, then overridesaria-haspopup="menu"; opens on click / Enter / Space / ArrowDown;ref={mergeRefs(contentRef, popover.triggerRef, buttonRef)}so the auto-current effect and focus-return still work.useListFocus+useTypeaheadoverMENU_ITEM_SELECTOR; Escape closes and returns focus to the trigger; Tab closes (APG menu-button pattern).ARIA
aria-haspopup"menu"aria-expanded/aria-controlsrole="menu"role="menuitem"/menuitemcheckbox/menuitemradioaria-current="page"isCurrentResolved decisions
DropdownMenuOption[]array and composed children (matches DropdownMenu/ContextMenu).Breadcrumb*aliases for family coherence + discoverability.menu+isCurrentallowed together (keeps botharia-current="page"andaria-haspopup="menu").menu+href(andmenu+onClick) disallowed in v1 → dev-warn,menuwins.menuSizedefault from breadcrumb variant:supporting→sm, elsemd.Render-mode precedence:
isCurrent→menu→href→onClick→ span.Testing
DropdownMenuOption[]renders), composed children, selectable checkbox + radio group, keyboard (ArrowDown opens, arrow rove, Escape closes + returns focus),menu+isCurrent,menu+hrefwarns & menu wins, mid-trail separators intact.pnpm -F @astryxdesign/core build(incl. tsc), lint, check:sync, sync:exports --check, check:changesets all pass.Closes #4159