You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shared MenuItem component for Menu, Sidenav, and standalone use
#2715
Is consumed internally by the existing Menu component.
Is consumed internally by the new (not yet implemented) Sidenav component.
Is exported as a standalone component that can be used atomically.
The primitive must preserve every behaviour the Menu item has today and cover every behaviour the Sidenav item requires, without forcing either container to inherit the other's constraints.
This discussion consolidates the standalone study, the current Menu implementation, and the Sidenav specification, then proposes an API and surfaces the decisions the team must make.
The current, production Menu behaviour that must be preserved.
The study's own conclusion (pinned note, verbatim intent)
Create a menu item component used internally by menu and sidenav. It changes the menu's typography and icon size (from text3 to text2, and from 24 to 20). It can be defined as active/selected, take a description and an asset, and act as a checkbox — the checkbox accessibility needs solving; a slot alone is not enough.
Context
3.1 Menu today (menu.tsx)
Exports Menu, MenuItem, MenuSection.
MenuItem is an ExclusifyUnion of three interaction shapes:
Content layout: optional icon, label in Text3, optional description in Text2; 12px vertical / 8px horizontal padding. Checkbox variant renders a control on the right with space="between".
Accessibility: container role menu; item role menuitem or menuitemcheckbox; target has aria-haspopup="menu" and aria-expanded; disabled sets aria-disabled.
Keyboard (open): Down/Right next, Up/Left previous, Enter/Space activate, Esc close, Tab stops propagation. (closed): Enter/Space open with keyboard flag; Down opens if target focused.
Positioning / state: Menu owns open/close, focused item, keyboard-open flag, and above/below placement via a MenuContext.
3.2 Sidenav requirements (specs/sidenav.md)
The sidenav item is a richer surface:
Selected indicator: 2px wide, 20px tall bar, 6px gap to content; only on the selected item.
Asset: 20px; optional when expanded, required when collapsed (it is the only visible element).
Label: text2; when collapsed, shown as a tooltip on hover (and must still be in the DOM via a visually-hidden span for screen readers).
Right slot: optional; hidden when collapsed.
Chevron: 16px; only on items with children.
Content area: 44px tall on desktop, 48px on mobile; 8px horizontal padding.
Nesting: 24px indentation per level, applied to the item container.
Item-with-children rules: a 1st-level item with children only expands (no navigation); a 1st-level item without children navigates; a 2nd-level child navigates (and closes the panel in double-panel mode). An item can both navigate and reveal children (two targets).
Variants: Default, Brand, Alternative, Negative, Media — each remaps the item's background/selected/indicator/label tokens.
Accessibility: aria-current="page" for selected; two focus stops when an item both navigates and expands (row + chevron icon-button); default labels like Expand {item label} / Collapse {item label}; keyboard Arrow/Home/End/Escape model at the container level.
3.3 The study proposal
A single item primitive whose surface is the union of both: asset, label, optional description, optional right slot, checkbox control, selected/active state (indicator + tint), destructive, disabled, hover/pressed. The study normalises typography and icon size to the sidenav values (text2, 20px).
Principle: the primitive owns anatomy and visual state (asset, label, description, right slot, indicator, hover/pressed/selected/disabled, destructive). The container owns navigation orchestration (focus roving, opening panels, collapse state, ARIA container roles). Anything that requires knowledge of sibling items stays in the container.
5. Anatomy comparison
Element
Menu today
Sidenav needs
Unified primitive
Asset / icon
Icon, 24px
asset 20px (icon/circle/avatar), required when collapsed
asset slot, 20px (see §7.1)
Label
Text3
text2
text2 (see §7.1)
Description
supported (Text2)
not in spec, shown in study
supported, optional
Selected indicator
none
2px bar, controlActivated
supported, shown only in "indicator" selection mode
Selected background tint
none
backgroundSelected*
supported
Right slot
checkbox only
arbitrary slot, hidden when collapsed
generic right slot (checkbox is one preset)
Chevron (has children)
none
16px, neutralHigh
supported, container-driven
Checkbox control
controlType:'checkbox' + checked
not required
supported
Destructive
destructive
not in spec
supported
Disabled
disabled
(implied)
supported
Hover / pressed
hover class
hover + pressed tokens
supported
Collapsed + tooltip
n/a
required
supported, container-driven
Nesting indent
n/a (flat + sections)
24px/level
container-driven (padding), not primitive
Height / density
12px v-padding
44 desktop / 48 mobile
density prop injected by container
Colour variant
Default only
5 variants
variant prop injected by container
6. Behaviour inventory
6.1 Behaviours to preserve from Menu (non-negotiable)
Three exclusive interaction shapes: onPress, href, to (via ExclusifyUnion).
onPress(index) signature and controlType:'checkbox' + checked.
Link options: newTab, loadOnTop, fullPageOnWebView, onNavigate.
Roles menuitem / menuitemcheckbox when hosted by Menu.
Full keyboard model driven by the Menu container and MenuContext.
Hover/enabled/disabled visual states and destructive colouring.
No visual or API regression for existing Menu consumers.
6.2 Behaviours Sidenav adds
Selected indicator bar + selected background tint + pressed state.
Asset required in collapsed mode; label rendered as tooltip when collapsed (but kept for screen readers).
Right slot (arbitrary content), hidden when collapsed.
Chevron for items with children; item can navigate and expand simultaneously (two focus stops).
aria-current="page" selection semantics.
Five colour variants (Default/Brand/Alternative/Negative/Media).
Density switch (44/48).
Nesting indentation (container concern) and dialog/double-panel reveal (container concern).
7. Open tensions and recommendations
Each item below is a decision the discussion must resolve. A recommendation is given first, with alternatives.
7.1 Typography and icon size (text3/24 vs text2/20)
The study proposes normalising the Menu item to text2 and 20px to match the sidenav.
Recommended: adopt text2 / 20px as the unified default, but gate it behind a density/size token injected by the container so the Menu container can opt to keep its historical text3/24 if a full visual change is deemed a breaking change. Ship the unified value as the standalone default.
Alternative A: hard-change Menu to text2/20 everywhere (simplest, but a visible change to every current Menu consumer — treat as a breaking/visual-regression change and coordinate a release).
Alternative B: keep two size presets (compact = text3/24 legacy Menu, regular = text2/20 sidenav) permanently. More surface, less unification.
Decision needed: is changing Menu's type ramp acceptable, and is it breaking?
7.2 Selection model: checked vs selected vs aria-current
Menu expresses "chosen" via controlType:'checkbox' + checked (role menuitemcheckbox). Sidenav expresses "you are here" via a selected indicator + aria-current="page". These are semantically different (a toggle vs the current location).
Recommended: keep them as two distinct concepts on the primitive:
They are independent and may even co-exist visually, but the container decides which is meaningful.
Alternative: a single active/state enum. Rejected because it conflates toggle state with navigation location and muddies ARIA.
Decision needed: confirm the two-concept model and the exact prop names (selected vs active).
7.3 Checkbox accessibility (the study's flagged unknown)
The study notes that rendering a checkbox purely as a right-slot element is not accessible. In Menu this works because the whole row is menuitemcheckbox with aria-checked — the visual checkbox is decorative.
Recommended: the primitive must own the accessible checkbox semantics, not a slot. When controlType:'checkbox', the item sets role="menuitemcheckbox" (in Menu) / an appropriate checkbox role standalone, and drives aria-checked itself. The visual control is aria-hidden. Never expect consumers to wire a11y through the right slot.
Alternative: expose a dedicated MenuItemCheckbox variant component. Cleaner types, more components to maintain.
Decision needed: single MenuItem with controlType, or a separate checkbox variant component?
7.4 Right slot vs chevron vs checkbox (right-hand region)
Menu's right region is checkbox-only. Sidenav's is an arbitrary slot plus a chevron for children.
Recommended: one generic right slot for arbitrary content, with checkbox and chevron as first-class managed presets (so the container can control chevron direction/rotation and the primitive can own checkbox a11y). The slot is hidden when collapsed.
Decision needed: can right slot, checkbox, and chevron coexist, or are they mutually exclusive? (Sidenav shows right slot + chevron together.)
7.5 Description in the sidenav item
The sidenav spec does not list a description, but the study's Mix frame shows one.
Recommended: keep description on the primitive (optional). Sidenav simply never passes it; Menu and standalone may.
Decision needed: confirm sidenav will not use description, or add it to the sidenav spec.
7.6 Items with children — navigation + expand (two focus stops)
Sidenav needs an item that both navigates (row) and expands (chevron), i.e. two focus stops in one row. Menu has no equivalent.
Recommended: treat "has children / expandable" as a container concern. The primitive exposes the chevron preset and an onExpandToggle/expanded pair plus an accessible label hook; the Sidenav container wires the second focus stop and the panel logic. The primitive never owns panel opening.
Decision needed: where does the second focus stop's ARIA (Expand {label} icon-button) live — primitive preset or container?
7.7 Colour variants (Brand / Alternative / Negative / Media)
Sidenav themes the item across five variants; Menu is Default only.
Recommended: inject variant via context from the Sidenav container; the standalone primitive defaults to Default. Token maps come straight from specs/sidenav.md §Tokens.
Decision needed: does the standalone primitive expose variant publicly, or is it sidenav-internal only?
7.8 Collapsed state and tooltip
Collapsed rendering (asset only, label → tooltip, right slot hidden) is sidenav-specific.
Recommended:collapsed is a primitive prop driven by the Sidenav container. The primitive always renders the label in the DOM (visually-hidden when collapsed) and shows the tooltip; the container owns when to collapse.
Decision needed: none expected — confirm the visually-hidden-label rule is acceptable for standalone use too.
7.9 Container role mapping
The same primitive must be menuitem/menuitemcheckbox in Menu, a navigation link/listitem in Sidenav, and a sensible default standalone.
Recommended: the primitive accepts a role (or as) hint from context. Menu injects menuitem*; Sidenav injects link/nav semantics with aria-current; standalone defaults to menuitem unless overridden.
Decision needed: the standalone default role.
9. Standalone usage
Exporting the item atomically means a consumer can render a single row outside any Menu or Sidenav (e.g. a custom list, a settings row). For that to be safe:
The primitive must be self-sufficient for a11y (owns its own role and aria-*), since there is no container to inject roles.
It must have sensible defaults: Default variant, regular density, text2/20, menuitem (or a documented standalone) role.
Container-only behaviours (roving focus, panel reveal, collapse orchestration) are simply absent standalone — the item still renders and is interactive.
Impact
Avoid redefine the same UI pattern across two components and not have it available as a standalone component
Discussion Questions
Is changing the Menu item to text2/20 acceptable, and do we treat it as breaking? (§7.1)
Two-concept selection (checked vs selected) confirmed? Final prop names? (§7.2)
Single MenuItem with controlType, or a dedicated checkbox variant, for accessible checkbox semantics? (§7.3)
Can right slot + chevron + checkbox coexist, and in what order? (§7.4)
Does Sidenav adopt description or stay without it? (§7.5)
Where does the "navigate + expand" second focus stop's ARIA live? (§7.6)
Is variant public on the standalone item or sidenav-internal? (§7.7)
Standalone default role? (§7.9)
Do we ship the primitive first (with Menu refactored onto it) before Sidenav is built, or build both together?
Additional considerations
Resolve §7 tensions in this discussion.
Refactor the current Menu onto the new primitive with zero behavioural regression (guarded by the existing Menu tests and visual regression).
Build Sidenav on top of the same primitive, layering collapse/panel/variant behaviour in the container.
Publish the standalone MenuItem with documented defaults.
Update the Figma library so the component structure mirrors the code (one item component, container-driven variants).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Goal
Define a single
MenuItemprimitive that:Menucomponent.Sidenavcomponent.The primitive must preserve every behaviour the
Menuitem has today and cover every behaviour theSidenavitem requires, without forcing either container to inherit the other's constraints.This discussion consolidates the standalone study, the current Menu implementation, and the Sidenav specification, then proposes an API and surfaces the decisions the team must make.
Sources
specs/sidenav.md)menu.tsx(mistica-web)The study's own conclusion (pinned note, verbatim intent)
Context
3.1 Menu today (
menu.tsx)Exports
Menu,MenuItem,MenuSection.MenuItemis anExclusifyUnionof three interaction shapes:onPress: (item: number) => void,controlType?: 'checkbox',checked?: booleanhref: string,newTab?,loadOnTop?,onNavigate?to: string,newTab?,fullPageOnWebView?,onNavigate?label: string(required),description?: string,Icon?,destructive?: boolean,disabled?: boolean,dataAttributes?labelinText3, optionaldescriptioninText2; 12px vertical / 8px horizontal padding. Checkbox variant renders a control on the right withspace="between".menuItemEnabled/menuItemDisabled/menuItemHovered; destructive uses danger colour, default uses neutral-high.menu; item rolemenuitemormenuitemcheckbox; target hasaria-haspopup="menu"andaria-expanded; disabled setsaria-disabled.MenuContext.3.2 Sidenav requirements (
specs/sidenav.md)The sidenav item is a richer surface:
text2; when collapsed, shown as a tooltip on hover (and must still be in the DOM via a visually-hidden span for screen readers).transparent→ hoverbackgroundContainerHover→ pressedbackgroundContainerPressed; selectedbackgroundSelected(+ hover/pressed); selected indicatorcontrolActivated; labeltextPrimary; chevronneutralHigh.aria-current="page"for selected; two focus stops when an item both navigates and expands (row + chevron icon-button); default labels likeExpand {item label}/Collapse {item label}; keyboard Arrow/Home/End/Escape model at the container level.3.3 The study proposal
A single item primitive whose surface is the union of both: asset, label, optional description, optional right slot, checkbox control, selected/active state (indicator + tint), destructive, disabled, hover/pressed. The study normalises typography and icon size to the sidenav values (
text2, 20px).4. Proposed architecture
Split responsibilities into three layers:
Principle: the primitive owns anatomy and visual state (asset, label, description, right slot, indicator, hover/pressed/selected/disabled, destructive). The container owns navigation orchestration (focus roving, opening panels, collapse state, ARIA container roles). Anything that requires knowledge of sibling items stays in the container.
5. Anatomy comparison
Icon, 24pxassetslot, 20px (see §7.1)Text3text2text2(see §7.1)Text2)controlActivatedbackgroundSelected*rightslot (checkbox is one preset)neutralHighcontrolType:'checkbox'+checkeddestructivedisableddensityprop injected by containervariantprop injected by container6. Behaviour inventory
6.1 Behaviours to preserve from Menu (non-negotiable)
onPress,href,to(viaExclusifyUnion).onPress(index)signature andcontrolType:'checkbox'+checked.newTab,loadOnTop,fullPageOnWebView,onNavigate.label(required),description,Icon,destructive,disabled,dataAttributes.menuitem/menuitemcheckboxwhen hosted byMenu.Menucontainer andMenuContext.Menuconsumers.6.2 Behaviours Sidenav adds
aria-current="page"selection semantics.7. Open tensions and recommendations
Each item below is a decision the discussion must resolve. A recommendation is given first, with alternatives.
7.1 Typography and icon size (
text3/24 vstext2/20)The study proposes normalising the Menu item to
text2and 20px to match the sidenav.text2/ 20px as the unified default, but gate it behind adensity/sizetoken injected by the container so the Menu container can opt to keep its historicaltext3/24 if a full visual change is deemed a breaking change. Ship the unified value as the standalone default.text2/20 everywhere (simplest, but a visible change to every current Menu consumer — treat as a breaking/visual-regression change and coordinate a release).compact= text3/24 legacy Menu,regular= text2/20 sidenav) permanently. More surface, less unification.7.2 Selection model:
checkedvsselectedvsaria-currentMenu expresses "chosen" via
controlType:'checkbox'+checked(rolemenuitemcheckbox). Sidenav expresses "you are here" via a selected indicator +aria-current="page". These are semantically different (a toggle vs the current location).checked(+controlType) → checkbox semantics, right-side control,menuitemcheckbox(Menu).selected→ indicator bar + tint +aria-current="page"(Sidenav / standalone navigation).active/stateenum. Rejected because it conflates toggle state with navigation location and muddies ARIA.selectedvsactive).7.3 Checkbox accessibility (the study's flagged unknown)
The study notes that rendering a checkbox purely as a right-slot element is not accessible. In Menu this works because the whole row is
menuitemcheckboxwitharia-checked— the visual checkbox is decorative.controlType:'checkbox', the item setsrole="menuitemcheckbox"(in Menu) / an appropriate checkbox role standalone, and drivesaria-checkeditself. The visual control isaria-hidden. Never expect consumers to wire a11y through the right slot.MenuItemCheckboxvariant component. Cleaner types, more components to maintain.MenuItemwithcontrolType, or a separate checkbox variant component?7.4 Right slot vs chevron vs checkbox (right-hand region)
Menu's right region is checkbox-only. Sidenav's is an arbitrary slot plus a chevron for children.
rightslot for arbitrary content, withcheckboxandchevronas first-class managed presets (so the container can control chevron direction/rotation and the primitive can own checkbox a11y). The slot is hidden whencollapsed.rightslot,checkbox, andchevroncoexist, or are they mutually exclusive? (Sidenav shows right slot + chevron together.)7.5 Description in the sidenav item
The sidenav spec does not list a description, but the study's Mix frame shows one.
descriptionon the primitive (optional). Sidenav simply never passes it; Menu and standalone may.description, or add it to the sidenav spec.7.6 Items with children — navigation + expand (two focus stops)
Sidenav needs an item that both navigates (row) and expands (chevron), i.e. two focus stops in one row. Menu has no equivalent.
onExpandToggle/expandedpair plus an accessible label hook; the Sidenav container wires the second focus stop and the panel logic. The primitive never owns panel opening.Expand {label}icon-button) live — primitive preset or container?7.7 Colour variants (Brand / Alternative / Negative / Media)
Sidenav themes the item across five variants; Menu is Default only.
variantvia context from the Sidenav container; the standalone primitive defaults to Default. Token maps come straight fromspecs/sidenav.md§Tokens.variantpublicly, or is it sidenav-internal only?7.8 Collapsed state and tooltip
Collapsed rendering (asset only, label → tooltip, right slot hidden) is sidenav-specific.
collapsedis a primitive prop driven by the Sidenav container. The primitive always renders the label in the DOM (visually-hidden when collapsed) and shows the tooltip; the container owns when to collapse.7.9 Container role mapping
The same primitive must be
menuitem/menuitemcheckboxin Menu, a navigation link/listitemin Sidenav, and a sensible default standalone.role(oras) hint from context. Menu injectsmenuitem*; Sidenav injects link/navsemantics witharia-current; standalone defaults tomenuitemunless overridden.9. Standalone usage
Exporting the item atomically means a consumer can render a single row outside any Menu or Sidenav (e.g. a custom list, a settings row). For that to be safe:
aria-*), since there is no container to inject roles.regulardensity,text2/20,menuitem(or a documented standalone) role.Impact
Avoid redefine the same UI pattern across two components and not have it available as a standalone component
Discussion Questions
text2/20 acceptable, and do we treat it as breaking? (§7.1)checkedvsselected) confirmed? Final prop names? (§7.2)MenuItemwithcontrolType, or a dedicated checkbox variant, for accessible checkbox semantics? (§7.3)descriptionor stay without it? (§7.5)variantpublic on the standalone item or sidenav-internal? (§7.7)Additional considerations
Menuonto the new primitive with zero behavioural regression (guarded by the existing Menu tests and visual regression).Sidenavon top of the same primitive, layering collapse/panel/variant behaviour in the container.MenuItemwith documented defaults.All reactions