Skip to content

[Bug] DropdownMenuCheckboxItem, DropdownMenuRadioItem: choice rows are taller than action rows at every menu size #11964

Open

Description

@duytbp

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:

  1. Block padding. DropdownMenuItem sets its own block padding and narrows it per menu size: --spacing-2 on the root, --spacing-1 for sm, --spacing-1-5 for md (DropdownMenuItem.tsx L62, L109-L117, applied at L314). The checkbox and radio rows' root styles set no block padding and have no size styles (DropdownMenuCheckboxItem.tsx L49-L67, DropdownMenuRadioItem.tsx L46-L64), so they keep Item's default balanced density, --spacing-2 at every size (Item.tsx L592-L603). Both rows already carry data-size from themeProps('dropdown-menu-item', {size: menuSize}), but nothing in the component reads it for padding.
  2. Control size. Both rows map the menu size to the indicator size as menuSize === 'sm' ? 'sm' : 'md' (DropdownMenuCheckboxItem.tsx L183, DropdownMenuRadioItem.tsx L167), so a md menu, the default, draws the 24 px control (CheckboxIndicator.tsx L126-L135, RadioIndicator.tsx L101-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>
  );
}
  1. Render <Repro size="md" /> in a desktop browser.
  2. Read each row's height: [...document.querySelectorAll('[role^="menuitem"]')].map((row) => [row.getAttribute('role'), row.getBoundingClientRect().height]).
  3. The menuitem row is 32 px; the menuitemcheckbox and menuitemradio rows are 40 px. Repeat with size="sm" (28 vs 36) and size="lg" (36 vs 40).

Suggested fix

  • Give the checkbox and radio rows the same block padding as DropdownMenuItem for each menu size, for example by moving itemSizeStyles (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 sm indicator (20 px) in sm and md menus, and md (24 px) only where the row has room for it (lg, whose 8 px padding plus 24 px gives 40 px, or keep sm there too for a 36 px row). If some menus need the larger control, an explicit controlSize prop on both items (or on DropdownMenuRadioGroup) 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

  1. jimmyallinai commented on Nov 16, 2026

    @jimmyallinai

    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 as DropdownMenuItem and 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.

  2. cixzhang commented on Nov 19, 2026

    @cixzhang
    Contributor

    (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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions