Skip to content

feat(popover): padding prop on Popover and usePopover - #6683

Merged
cixzhang merged 3 commits into
meta:mainfrom
vjeux:popover-surface-padding
Oct 2, 2026
Merged

cixzhang merged 3 commits into
meta:mainfrom
vjeux:popover-surface-padding

Conversation

@vjeux

@vjeux vjeux commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

User need

A builder puts content that owns its own edges inside a Popover — a list of rows whose hover paint should reach the surface edge, or a header row with a bottom rule — and cannot remove the surface inset. usePopover paints a fixed spacing-3 padding through a compiled StyleX class, which beats a consumer className by cascade layer; the outs are xstyle (needs the StyleX compiler), an inline style={{padding: 0}}, or the popover theme target (app-wide). Each is a different spelling of the spacing decision Card, Stack, LayoutContent and LayoutPanel already express as a padding prop.

Problem and solution fit

  • Primary: Popover takes padding on the shared spacing scale; usePopover takes the same option so a direct hook composition can ask for a rung too.
  • Supporting: the rung lands on the painted surface (the popover theme target) through the shared paddingStyles, where the released inset already sat, so a theme's padding on that target keeps replacing it instead of nesting. Tests, doc entries and examples, a changeset, and the contract text below. No tagalongs.

Current specification

component:Popover (Popover.spec.md, authority: current) has no padding concept. This PR adds FR8 and DEC-4 to that record, marked pending owner review — the one unresolved owner decision. architecture:container-padding leaves a padding prop to the component's own API review and this is not a container-protocol enrollment: the surface publishes no edge geometry.

Public delta and caller burden

  • PopoverProps.padding?: 0 | 0.5 | 1 | 1.5 | 2 | 3 | 4 | 5 | 6 | 8 | 10 — default 3, the released inset, so nothing moves for existing callers.
  • UsePopoverOptions.padding? — same type; omitted, the hook paints no padding of its own (its released behavior).
  • 0 is the flush surface; the caller then pads its own content.
  • xstyle, className and style keep their precedence (they merge after the rung).
// before: the only per-surface out
<Popover content={<Rows />} style={{padding: 0}} />
// after
<Popover content={<Rows />} padding={0} />

Design and alternatives

  • 0 rather than a 'none' string: the existing prop vocabulary spells the flush case as 0, and two spellings of one state is a caller burden.
  • Rejected: moving the padding onto an inner wrapper a consumer class can replace — that puts the released theming placement back inside a nested box.

Evidence

  • Default paints the spacing-3 rung, unchanged; padding={0} paints no padding with the content reaching the surface edge; a rung (4) paints that rung; a direct usePopover consumer paints none by default and can opt into a rung.
  • Design review approved on this PR.

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

npx vitest run packages/core/src/Popover scripts/check-knowledge.test.mjs
  Test Files 2 passed · Tests 146 passed
pnpm lint — 0 errors (82 pre-existing warnings, none in Popover/)
pnpm test -- --maxWorkers=4 — 907 files passed; 6 load-dependent files failed on a shared box and pass re-run alone (403 tests)
pnpm -F @astryxdesign/core build — 629 dist files checked
node scripts/check-knowledge.mjs — Knowledge templates and records are aligned.

@vercel

vercel Bot commented Sep 28, 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 1, 2026 2:36am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 28, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 28, 2026
@astracat-bot

astracat-bot Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 1, 2026, 2:52 AM UTC

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

Approval is waiting on a maintainer decision about the spec for this addition.

This change adds a padding prop to Popover (spacing scale, default 3, with 0 for a flush surface) and the same option to usePopover. The implementation keeps today's defaults: Popover still paints the spacing-3 inset, direct usePopover consumers still paint no padding unless they opt in, and the padding lands on the painted surface so consumer styling still merges after it. The new tests cover the default, the flush case, another rung, and the direct hook case.

What is missing is governing authority for the new public API itself. The current Popover contract records its public surface with no padding concept, and the container-padding architecture says it does not authorize a padding prop for another component. A maintainer therefore needs to provide or identify the governing spec for Popover — settling the prop and hook option, the flush 0 case, how it interacts with a theme's padding on the popover surface and with xstyle, and whether the surface should publish container-padding geometry for content that bleeds to its edges. No code change is being requested for that gap alone; once that decision is recorded, this change can be judged on its implementation, which raised no other blocking findings here.

[Automated review]

github-actions Bot added a commit that referenced this pull request Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

Popover (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 760 -
Complexity N/A Very High (83) -

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

1 of 420 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
SideNav Resizable in AppShell probe dark 3,208

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

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Sep 28, 2026
github-actions Bot added a commit that referenced this pull request Sep 28, 2026

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

Approval is waiting on a maintainer decision about the spec for this addition.

This change adds a padding prop to Popover (spacing scale, default 3, with 0 for a flush surface) and the same option to usePopover. The implementation keeps today's defaults: Popover still paints the spacing-3 inset, direct usePopover consumers still paint no padding unless they opt in, and the padding lands on the painted surface so consumer styling still merges after it. The new tests cover the default, the flush case, another rung, and the direct hook case.

What is missing is governing authority for the new public API itself. The current Popover contract records its public surface with no padding concept, and the container-padding architecture says it does not authorize a padding prop for another component. This PR now records its own proposal for that contract — DEC-4 and FR8, marked pending owner review — but a proposal in the PR does not settle its own authority. A maintainer therefore needs to provide or identify the governing spec for Popover: approve the proposed DEC-4 record, or point to another governing record, settling the prop and hook option, the flush 0 case, how it interacts with theme padding on the popover surface and with xstyle, and whether the surface should publish container-padding geometry for content that bleeds to its edges. No code change is being requested for that gap alone; once that decision is recorded, this change can be judged on its implementation, which raised no other blocking findings here.

[Automated review]

@kentonquatman kentonquatman 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.

Looks good from the design side 👍

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

This change is ready from this review.

It adds a padding prop to Popover on the shared spacing scale (default 3, unchanged, with 0 for a flush surface when content owns its own edges) and the same option to usePopover, where omitting it keeps the hook's current no-padding behavior. The padding lands on the painted popover surface, so theme styling and xstyle keep the precedence they have today, and no container-padding geometry is published.

The governing spec question is settled: the Popover spec owner has approved DEC-4/FR8 for exactly this API. The implementation was checked against that decision point by point, the Popover test suite passes (46 tests, including the new default, flush, rung, and direct-hook cases), and the default popover renders identically before and after the change.

[Automated review]

@vjeux vjeux changed the title feat(popover): padding prop on Popover and usePopover — a flush surface for content that owns its edges feat(popover): padding prop on Popover and usePopover Oct 1, 2026
@github-actions
github-actions Bot requested a review from kentonquatman October 1, 2026 02:28
@cixzhang
cixzhang enabled auto-merge (squash) October 2, 2026 01:10
@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Oct 2, 2026
@cixzhang
cixzhang merged commit ed2e54e into meta:main Oct 2, 2026
39 checks passed
@vjeux
vjeux deleted the popover-surface-padding branch October 2, 2026 01:20

This branch was successfully deployed

1 active deployment
Preview — 8d548e6e Deployed Oct 1, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants