Skip to content

feat(command-palette): add command-palette-group-heading theme target - #4422

Merged
cixzhang merged 1 commit into
mainfrom
feat/command-palette-group-heading-theme-target
Jul 27, 2026
Merged

feat(command-palette): add command-palette-group-heading theme target#4422
cixzhang merged 1 commit into
mainfrom
feat/command-palette-group-heading-theme-target

Conversation

@freddymeta

Copy link
Copy Markdown
Contributor

What

Adds a dedicated astryx-command-palette-group-heading theme target to the CommandPaletteGroup heading text.

Why

CommandPaletteGroup renders its heading (e.g. a "Suggestions" label) as a <div aria-hidden="true"> that carries only its StyleX class. The group root already exposes astryx-command-palette-group via themeProps, but the heading itself has no stable theme target. A theme that wants to style just the heading — for example its padding or typography — can today reach it only through a fragile structural selector, which couples themes to internal DOM structure and breaks the moment the group's markup changes.

This adds the target the sanctioned way (themeProps + theming.targets), consistent with the existing astryx-command-palette-* family and the recent sibling theme-target additions (astryx-tree-list-item-label, astryx-tree-list-chevron), so defineTheme can scope overrides to the heading alone.

What changed

  • CommandPaletteGroup.tsxthemeProps('command-palette-group-heading') spread (via mergeProps) onto the heading <div>, rendering a stable astryx-command-palette-group-heading class. Which element: the group root keeps astryx-command-palette-group; this new target lands on the heading child <div> — distinct handles for the group vs. its heading text.
  • CommandPalette.doc.mjs — new {className: 'astryx-command-palette-group-heading'} entry in docs.theming.targets, keeping the themingTargets guard green. (CommandPalette's docsZh is a lightweight TranslationDoc overlay with no theming block — adding one there would be a mismatched, out-of-scope conversion, so the target is documented in the canonical EN docs.theming.targets that the guard and codegen read.)
  • CommandPaletteGroup.test.tsx — asserts the target class renders on the heading, stays distinct from the group root, keeps the heading decorative (aria-hidden), and that a defineTheme({ components: { 'command-palette-group-heading': { base } } }) resolves to the .astryx-command-palette-group-heading selector in generated CSS.
  • CommandPalette.stories.tsx — a ThemedGroupHeading story demonstrating a heading override (bold/accent/uppercase) via defineTheme.
  • Changeset ([feat], patch).

Notes

  • Purely additive: default rendering is byte-identical — the change only adds a class. No new prop, no behavior change.
  • The heading remains aria-hidden="true"; grouping is still announced via the root's aria-label.
  • StyleX-only; no raw CSS; no new hardcoded values.

The CommandPaletteGroup heading carries no themeable handle: the group
root has `astryx-command-palette-group`, but the heading `<div>` had only
its StyleX class, so a theme could reach it only through a fragile
structural selector.

Add a `themeProps('command-palette-group-heading')` surface on the
heading element so it renders a stable `astryx-command-palette-group-heading`
class. Default rendering is byte-identical — the change only adds the class.

Documents the new target in CommandPalette.doc.mjs (theming.targets), adds
tests asserting the class renders, stays distinct from the group root, keeps
the heading decorative, and that a defineTheme override resolves to the
`.astryx-command-palette-group-heading` selector, plus a Storybook story
showing a heading override.
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 27, 2026 1:30pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 27, 2026
@github-actions github-actions Bot added community Authored by a community contributor (not on the eng/design team) needs:code-review High-risk change (new package/component/API) — needs human code review before merge labels Jul 27, 2026
github-actions Bot added a commit that referenced this pull request Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

CommandPalette · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 988 -
Complexity N/A Very High (110) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@cixzhang
cixzhang enabled auto-merge (squash) July 27, 2026 16:40
@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Jul 27, 2026
@cixzhang
cixzhang merged commit f5a6286 into main Jul 27, 2026
20 checks passed
@github-actions
github-actions Bot deleted the feat/command-palette-group-heading-theme-target branch July 28, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. community Authored by a community contributor (not on the eng/design team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants