Skip to content

fix(webkit): reserve one icon column in the command menu and even its group rhythm - #890

Open
gabriel-lisboa-azion wants to merge 1 commit into
mainfrom
fix/command-menu-icon-column
Open

fix(webkit): reserve one icon column in the command menu and even its group rhythm#890
gabriel-lisboa-azion wants to merge 1 commit into
mainfrom
fix/command-menu-icon-column

Conversation

@gabriel-lisboa-azion

Copy link
Copy Markdown
Collaborator

Summary

  • Labels in a grouped palette did not share a left edge — an iconed row put its label 20px right of an icon-less one. Items already register with the root, so hasPrefix rides that registry and the root derives hasPrefixColumn; every item then reserves a fixed size-4 box (Menu's glyph size) as soon as ANY item in the list carries a prefix. A palette with no icons reserves nothing and pays no indent.
  • Group rhythm now matches the Dropdown group divider: 12 above a separator, 8 below it, 12 between two bare groups — one sibling-scoped variant that deliberately does not match after a separator, so the two can never stack. The list's vertical seam goes from --spacing-xxs to --spacing-xs.
  • Group headings drop text-overline-sm + uppercase for text-label-sm.

How to test

  1. pnpm storybook:dev → Components/Overlay/CommandMenu. In the grouped story, every label starts on the same x whether or not its row has an icon; the palette with no icons at all carries no indent.
  2. Check the seams in the same story: 12px above the separator, 8px below it, 12px between two bare groups — a separator and a group boundary never stack their spacing.
  3. pnpm --filter @aziontech/webkit test -- src/components/overlay/command-menu/command-menu.test.ts → 14 passing, including the reserved-column cases (mixed iconed/icon-less list reserves the box for both; an all-text list reserves none).

Notes

  • Visual baselines for components-overlay-commandmenu--* will need regenerating in CI — the spacing and heading typography both move.

… group rhythm

Three things were off in a grouped palette.

Labels did not share a left edge: the `prefix` slot is conditional, so an
iconed row put its label at x=355 and an icon-less one at x=335. Items already
register with the root, so `hasPrefix` rides that registry and the root derives
`hasPrefixColumn`; every item then reserves a fixed `size-4` box — Menu's glyph
size — as soon as ANY item in the list carries a prefix. All labels now land on
x=359. A palette with no icons reserves nothing, so it pays no indent. The
registry resolves before first paint (the same mechanism `groupHasVisibleItems`
already uses), so there is no layout jump on open.

Groups sat flush at 0px unless the consumer inserted a `Separator`, whose own
rhythm was 4/4. Both now match the Dropdown group divider: 12 above the
separator, 8 below it, and 12 between two bare groups. The group's spacing rule
is a single sibling-scoped variant that deliberately does not match after a
separator, so the separator owns the space around itself and the two can never
stack — one selector rather than two competing ones, because Tailwind orders
variants by its own rules and two overlapping `mt-*` variants would be a
specificity coin-flip.

The list's vertical seam was `--spacing-xxs` against a 16px text inset, the
same crowding the Dropdown panel had; it goes to `--spacing-xs`.

Group headings drop `text-overline-sm` + `uppercase` for `text-label-sm`.

The `prefix` slot had no story coverage at all, so none of this was visible:
Grouped becomes three groups with one separator and half the items iconed,
which shows both spacings and the shared label edge in one frame.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant