Skip to content

feat(core): give ComplexSelector and MultiSelector popups a theme target - #4991

Merged
cixzhang merged 1 commit into
mainfrom
popup-theme-target
Aug 13, 2026
Merged

cixzhang merged 1 commit into
mainfrom
popup-theme-target

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

Why

A theme can style a ComplexSelector trigger and nothing inside its popup. Both this component and MultiSelector render a stable target on the field (astryx-complex-selector, astryx-multi-selector) and on inner details — the chevron, the option row, the empty state — but the popup surface itself carries no target at all. That surface is the part that has to match the rest of an app's menus: its background, border, radius and elevation are what make a picker look like it belongs, and today they can only be reached by forking the component or writing a structural selector against StyleX-generated classes.

The gap has bitten a real consumer. In #4804 an app's menu came out 24px wider than its own panels with no border, reading as edgeless on a dark theme; the workaround shipped there pulls the content back out to the surface edge with a negative margin and repaints the border, which depends on the component's internal padding staying what it is.

What

astryx-complex-selector-popup and astryx-multi-selector-popup, on the popup's content box. Purely additive: no API change, no default visual change.

The target goes on the content box, not the layer. useLayer zeroes the layer element's borders, padding and background — it is a bare positioning box — so the content box inside it is the element that actually paints, and it is the one a theme has to reach. That is the convention worth settling for the whole layer family: the popup's paint surface gets <component>-popup, alongside the existing <component>-<part> sub-element targets.

Selector is deliberately not in this change. Its popup root differs by branch — with hasSearch it is a wrapper div, without it the listbox itself — so a stable target there means unifying that structure first, which does not belong in an additive theming change. Happy to follow up.

Not addressed here, and worth their own issues: HoverCard, Tooltip and MoreMenu render no theme targets at all, and contentXstyle remains StyleX-only, which is the other half of #4804.

Risk

None expected. The classes are new, nothing is renamed or moved, and no styles change. themingTargets.test.ts enforces that every themeProps() class is documented, so the new theming.targets entries are covered by that guard.

Testing

vitest on both components: 104 pass, including three new assertions that the target lands on the content box inside the layer and not on the layer itself, and that it survives a consumer-supplied contentXstyle. Neutralizing each themeProps() call fails exactly those tests and nothing else. packages/core typecheck and eslint clean; the theme suite (620 tests, including the themingTargets guard) passes.

Both components target their trigger but nothing in the popup, so a theme
cannot style the surface that has to match the rest of an app's menus.

The target goes on the popup's content box, not the layer: useLayer zeroes
the layer's borders, padding and background, so the content box is what
paints. Purely additive — default rendering is unchanged.
@cixzhang cixzhang added theming Theming system, design tokens, createTheme component New or improved UI component labels Aug 13, 2026
@vercel

vercel Bot commented Aug 13, 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 Aug 13, 2026 1:47pm

Request Review

@cixzhang cixzhang added the component New or improved UI component label Aug 13, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 13, 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

ComplexSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 350 -
Complexity N/A Very High (31) -
MultiSelector (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1434 -
Complexity N/A Very High (178) -

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.


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

github-actions Bot added a commit that referenced this pull request Aug 13, 2026
@cixzhang
cixzhang merged commit 9bb4084 into main Aug 13, 2026
18 checks passed
cixzhang added a commit that referenced this pull request Aug 14, 2026
…5009)

* fix(core): move the popup theme targets onto the surface that paints

The targets added in #4991 landed on each component's content box, while
the element carrying background, radius and elevation is the surface
usePopover renders one level above it. A theme rule written against those
classes could not paint the popup.

usePopover now names the surface: a shared astryx-popover-surface on every
popup, plus an optional per-component surfaceTarget. Selector gains the
astryx-selector-popup its sibling MultiSelector already had.

* test(cli): teach the documented-target guard about surfaceTarget

The guard scans core for themeProps()/stableClassName()/legacyNames
literals. A surface target is a literal too — it just rides a
usePopover option, because the element it names is not the component's
to render.
@github-actions
github-actions Bot deleted the popup-theme-target branch August 14, 2026 06:33

This branch was successfully deployed

1 active deployment
Preview — 1447919c Deployed Aug 13, 2026 by vercel[bot]
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. component New or improved UI component theming Theming system, design tokens, createTheme

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant