Repository navigation
feat(popover): padding prop on Popover and usePopover - #6683
Conversation
…ce for content that owns its edges
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewModified ComponentsPopover (@astryxdesign/core) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression1 of 420 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
Looks good from the design side 👍
There was a problem hiding this comment.
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]
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.
usePopoverpaints a fixed spacing-3 padding through a compiled StyleX class, which beats a consumerclassNameby cascade layer; the outs arexstyle(needs the StyleX compiler), an inlinestyle={{padding: 0}}, or thepopovertheme target (app-wide). Each is a different spelling of the spacing decisionCard,Stack,LayoutContentandLayoutPanelalready express as apaddingprop.Problem and solution fit
Popovertakespaddingon the shared spacing scale;usePopovertakes the same option so a direct hook composition can ask for a rung too.popovertheme target) through the sharedpaddingStyles, where the released inset already sat, so a theme'spaddingon 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-paddingleaves 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— default3, 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).0is the flush surface; the caller then pads its own content.xstyle,classNameandstylekeep their precedence (they merge after the rung).Design and alternatives
0rather than a'none'string: the existing prop vocabulary spells the flush case as0, and two spellings of one state is a caller burden.Evidence
padding={0}paints no padding with the content reaching the surface edge; a rung (4) paints that rung; a directusePopoverconsumer paints none by default and can opt into a rung.Scope
Testing