Repository navigation
Description
Description
In a popover DropdownMenu, a DropdownMenuCheckboxItem or DropdownMenuRadioItem row is taller than a DropdownMenuItem row in the same menu, at every menu size. A menu that mixes actions with a checkbox or radio set (a "View" menu: "Save current view", "Show archived", "Sort by") ends up with uneven rows.
Measured in Chromium (1440 × 900, default theme, 14 px label on a 20 px line) against @astryxdesign/core@0.7.16:
Menu size (button.size) |
DropdownMenuItem row |
Checkbox / radio row | Choice row padding | Control drawn |
|---|---|---|---|---|
sm |
28 px (4 px + 4 px) | 36 px | 8 px + 8 px | 20 px |
md (default) |
32 px (6 px + 6 px) | 40 px | 8 px + 8 px | 24 px |
lg |
36 px (8 px + 8 px) | 40 px | 8 px + 8 px | 24 px |
Cause. Two things add up:
- Block padding.
DropdownMenuItemsets its own block padding and narrows it per menu size:--spacing-2on the root,--spacing-1forsm,--spacing-1-5formd(DropdownMenuItem.tsxL62, L109-L117, applied at L314). The checkbox and radio rows'rootstyles set no block padding and have no size styles (DropdownMenuCheckboxItem.tsxL49-L67,DropdownMenuRadioItem.tsxL46-L64), so they keepItem's defaultbalanceddensity,--spacing-2at every size (Item.tsxL592-L603). Both rows already carrydata-sizefromthemeProps('dropdown-menu-item', {size: menuSize}), but nothing in the component reads it for padding. - Control size. Both rows map the menu size to the indicator size as
menuSize === 'sm' ? 'sm' : 'md'(DropdownMenuCheckboxItem.tsxL183,DropdownMenuRadioItem.tsxL167), so amdmenu, the default, draws the 24 px control (CheckboxIndicator.tsxL126-L135,RadioIndicator.tsxL101-L110), which is taller than the 20 px label line and so sets the row's content height. Neither component takes a prop to pick the control size.
So in sm the padding alone adds 8 px; in md the padding and the 24 px control add 8 px between them; in lg the 24 px control adds 4 px.
Expected: a checkbox or radio row is as tall as an action row of the same menu size (28 / 32 / 36 px), so a mixed menu has one row rhythm.
Reproduction
import {
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuItem,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
} from '@astryxdesign/core/DropdownMenu';
const noop = () => {};
export function Repro({size}: {size: 'sm' | 'md' | 'lg'}) {
return (
<DropdownMenu
button={{label: 'View', size}}
presentation="popover"
isMenuOpen
onOpenChange={noop}>
<DropdownMenuItem label="Save current view" onClick={noop} />
<DropdownMenuCheckboxItem label="Show archived" value onChange={noop} />
<DropdownMenuRadioGroup label="Sort by" value="number" onChange={noop}>
<DropdownMenuRadioItem value="number" label="Number" />
</DropdownMenuRadioGroup>
</DropdownMenu>
);
}- Render
<Repro size="md" />in a desktop browser. - Read each row's height:
[...document.querySelectorAll('[role^="menuitem"]')].map((row) => [row.getAttribute('role'), row.getBoundingClientRect().height]). - The
menuitemrow is 32 px; themenuitemcheckboxandmenuitemradiorows are 40 px. Repeat withsize="sm"(28 vs 36) andsize="lg"(36 vs 40).
Suggested fix
- Give the checkbox and radio rows the same block padding as
DropdownMenuItemfor each menu size, for example by movingitemSizeStyles(and the root's--spacing-2) into a style the three rows share, so the three can't drift apart again. - Let the control size follow the menu size so it never outgrows the label line: the
smindicator (20 px) insmandmdmenus, andmd(24 px) only where the row has room for it (lg, whose 8 px padding plus 24 px gives 40 px, or keepsmthere too for a 36 px row). If some menus need the larger control, an explicitcontrolSizeprop on both items (or onDropdownMenuRadioGroup) would cover that without changing the default rhythm.
Workaround
A downstream app currently restores the rhythm with CSS on the rows' existing attributes:
:is([role='menuitemcheckbox'], [role='menuitemradio']).astryx-dropdown-menu-item[data-size='md'] {
padding-block: var(--spacing-1-5);
}
:is([role='menuitemcheckbox'], [role='menuitemradio']).astryx-dropdown-menu-item[data-size='sm'] {
padding-block: var(--spacing-1);
}
[role='menuitemcheckbox'].astryx-dropdown-menu-item > .astryx-checkbox-indicator,
[role='menuitemradio'].astryx-dropdown-menu-item > .astryx-radio-indicator {
inline-size: 20px;
block-size: 20px;
}Astryx Version
@astryxdesign/core@0.7.16 (source links above are main at 6919cd3, unchanged there)
Environment
Chromium (Playwright headless shell), 1440 × 900, fine pointer, default theme. Not browser-specific: the heights follow from the computed padding and indicator sizes.
Activity
jimmyallinai commentedon Nov 16, 2026
I'll take this one. Plan: reproduce the uneven row heights in a real browser (mixed menu at sm/md/lg, measuring each
[role^="menuitem"]row), then give the checkbox/radio rows the same per-size block padding asDropdownMenuItemand make the indicator size follow the menu size so it never outgrows the label line. I'll add a regression test asserting equal row heights at all three sizes and run the adjacent DropdownMenu tests plus lint/typecheck before opening a PR.cixzhang commentedon Nov 19, 2026
(Posted by Cindy's agent.) Thanks @duytbp for the measurements. Checkbox and radio rows should match action rows in the same menu, so we'll fix this together with #11984. @jimmyallinai, if you have a PR ready please open it; otherwise we'll pick it up and credit your plan. We'll update here.