Skip to content

feat(DropdownMenu): popoverXstyle styles the popover surface that paints the menu - #7202

Closed
vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:menu-surface-style
Closed

vjeux wants to merge 2 commits into
meta:mainfrom
vjeux:menu-surface-style

Conversation

@vjeux

@vjeux vjeux commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

User need

A builder who needs one menu's visible box to look different, say a phone sheet docked over a bar whose corners it must match, cannot style it. The box is the popover surface: it paints the background, radius and shadow, and declares the theme's tokens on itself. xstyle, className and style land on the transparent role="menu" inside it, so a 30px radius there paints nothing, and the popover theme target restyles every popover in the app.

Problem and solution fit

  • Primary: popoverXstyle?: StyleXStyles on DropdownMenu, handed to usePopover's xstyle, which merges after the surface's own styles.
  • Supporting: the bottom sheet drops the prop; the record's concept row, FR15 and DEC-8; prop doc, story, unit and Chromium cases, changeset.
  • Out of scope: the layer's viewport gutter. LayerProvider inset (spec:AST-059) widens it but cannot narrow it below spacing-4; that is a separate question for AST-059's owners. Sub-menu flyouts keep their own surfaces.

Current specification

component:DropdownMenu is a draft. This PR adds the concept row, FR15 and DEC-8 as proposed, pending owner review: admitting popoverXstyle is the one owner decision. Under spec:AST-002 FR1 and FR4, a docked sheet and an ordinary menu need different boxes, the caller knows which it rendered, and no existing seam reaches one menu's box. Related: #6683 (merged) gave Popover and usePopover a padding that DropdownMenu's surface does not use; #6686 (closed) became LayerProvider inset.

Public delta and caller burden

  • New optional popoverXstyle on both DropdownMenu modes; omitted, nothing changes.
  • It merges after the surface's background, radius and shadow; xstyle, className and style still reach the menu.
  • Ignored by the bottom-sheet presentation and by sub-menu flyouts.
const styles = stylex.create({sheet: {borderRadius: 30}});
// before: lands on the transparent menu and paints nothing
<DropdownMenu button={{label: 'More'}} xstyle={styles.sheet}>...</DropdownMenu>
// after
<DropdownMenu button={{label: 'More'}} popoverXstyle={styles.sheet}>...</DropdownMenu>

Design and alternatives

  • Named for the box DropdownMenu's API already calls the popover (presentation="popover", menuWidth's "minimum popover width"), in the <part>Xstyle form of ComplexSelector.contentXstyle.
  • Rejected: moving xstyle to the surface, which breaks callers styling the menu's padding, gap or block size; a dropdown-menu-popup theme target like Selector's, which restyles every menu.

Evidence

  • DropdownMenu.test.tsx: the style lands on the surface and replaces its radius; xstyle stays on the menu and the surface keeps its radius; the bottom sheet ignores the prop. Two of three fail on main.
  • Real Chromium, new Popover style story: the opaque surface computes a 24px radius and the menu inside stays transparent; with main's component the surface stays at the theme's 12px.

Writing rubric results

R1 narration: none; FR15 and DEC-8 are in the present tense.
R2 research: none.
R3 evidence: FR15 cites DEC-8 and test files.
R4 rejected alternatives: two, on one line inside DEC-8.
R5 change references: none.
R6 open questions: none.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm exec vitest run packages/core/src/DropdownMenu/DropdownMenu.test.tsx -t "DropdownMenu popoverXstyle"
  main's DropdownMenu.tsx: 2 failed, 1 passed · with the change: 3 passed

pnpm exec vitest run packages/core/src/DropdownMenu packages/core/src/Popover packages/core/src/ContextMenu \
  packages/core/src/docPropLiterals.test.ts packages/core/src/docPropReferences.test.ts --maxWorkers=4
  Test Files  7 passed (7)   Tests  314 passed (314)

pnpm storybook:build   (this branch, and the same branch with main's DropdownMenu.tsx)
ASTRYX_STORYBOOK_DIR=<main component build> pnpm exec playwright test \
  packages/core/src/DropdownMenu/__tests__/DropdownMenuPopoverStyle.a11y.chromium.spec.ts --project=chromium
  1 failed   Expected: "24px"   Received: "12px"
pnpm exec playwright test packages/core/src/DropdownMenu/__tests__/DropdownMenuPopoverStyle.a11y.chromium.spec.ts \
  packages/core/src/DropdownMenu/__tests__/MenuPress.a11y.chromium.spec.ts \
  packages/core/src/DropdownMenu/__tests__/DropdownMenuDrillIn.a11y.chromium.spec.ts --project=chromium
  14 passed (13.0s)

pnpm -F @astryxdesign/core typecheck     ✓
pnpm exec eslint packages/core/src/DropdownMenu apps/storybook/stories/DropdownMenu.stories.tsx   ✓ 0 errors
pnpm check:knowledge                     ✓ Knowledge templates and records are aligned.
node scripts/check-changesets.mjs        ✓

…nts the menu

The box a viewer sees as a pointer DropdownMenu is the popover surface: it
paints the background, the corner radius and the elevation, and carries the
theme scope. xstyle, className and style land on the role="menu" element
inside it, which paints no background, so no per-menu style could reach
the visible box. popoverXstyle is handed to usePopover's xstyle, which
merges after the surface's own styles. The bottom-sheet presentation drops
it; sub-menu flyouts keep their own surfaces. component:DropdownMenu gains
the concept row, FR15 and DEC-8 (proposed, pending owner review).
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 8, 2026 11:06pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 8, 2026
@astracat-bot

astracat-bot Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 10, 2026, 1:40 AM UTC

…part declares

CI lint (no-hardcoded-styles) rejects a literal radius in core sources,
tests included. A radius token would collide with parts that already
declare it (Item rows use radius-element), which defeats the bottom-sheet
case's class check, so the override reads a custom property no Astryx part
declares.
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

23 of 442 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
TableRowExpansion Detail Panel neutral dark 5,129
TableRowExpansion Detail Panel neutral light 4,050
SideNav Resizable in AppShell probe light 3,208
TableGroupedRows Default neutral light 2,133
TableGroupedRows Default neutral dark 2,116
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882

and 3 more.


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

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the focused proposal — the implementation and its evidence check out, and approval is now waiting on one maintainer decision.

popoverXstyle does what it claims: the style lands on the popover surface that paints the menu (24px measured in a real browser, against the theme's 12px without it), xstyle keeps styling the menu inside, and the bottom sheet and sub-menu flyouts are untouched. The new unit cases and the wider DropdownMenu suites pass, and existing callers see no change when the prop is omitted.

What remains is spec admission, not code changes. The governing DropdownMenu record on main is still a draft and no current spec admits a per-menu popover-surface styling seam; the FR15/DEC-8 text in this PR is explicitly proposed and pending owner review. Approval needs a maintainer to provide or identify the governing spec for this addition — for example by approving that proposed text — including the seam's breadth (any StyleX property merged after the surface's own styles, root pointer menu only), or to direct a different seam. No concrete defects were found in the implementation itself.

[Automated review]

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Owner ruling, cixzhang: no popoverXstyle. The menu's visible box is styled by theming the popover, not by a prop on each DropdownMenu.

The box is the popover surface, and its background, radius and shadow belong to the popover theme target. A per-instance prop turns a product's one-off corner match into permanent shared API on every menu, and it opens the whole surface (background, shadow, padding, the tokens declared there) to callsite overrides. It also doesn't serve the case it was written for, since the bottom-sheet presentation ignores it.

What this means for the PR:

  • Remove popoverXstyle from DropdownMenu, its doc, story, tests and changeset.
  • Remove the proposed concept row, FR15 and DEC-8 from DropdownMenu.spec.md.
  • If the popover theme target cannot express what a product needs on the menu's surface, open that as its own issue against the theme target, with the case, rather than as a component prop.

@cixzhang

Copy link
Copy Markdown
Contributor

Follow-up to the ruling above: the styling rule behind it is now proposed as spec:AST-071 in #7277. A styling input for a part comes as <part>Xstyle, <part>ClassName and <part>Style together, or it is not admitted, so callers who style with class names or inline styles can reach every part StyleX can. That rule doesn't make popoverXstyle acceptable with counterparts added: the menu's box is still themed through popover.

@vjeux

vjeux commented Oct 10, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the ruling. Following it: no popoverXstyle. The menu's surface will be styled through the popover theme target, and what that target can't express yet goes in its own issue against the target, with the case. Closing this PR.

@vjeux vjeux closed this Oct 10, 2026
@vjeux
vjeux deleted the menu-surface-style branch October 10, 2026 01:58

This branch was successfully deployed

1 active deployment
Preview — 520eebb5 Deployed Oct 8, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants