Repository navigation
feat(core): BottomSheet publishes container padding, like Dialog - #6883
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression14 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.
Thanks for making BottomSheet work like Dialog here — the preserved default, the published inset for Section and bleed children, and the focused tests and browser comparison all read clearly.
Approval needs a maintainer spec decision first. As it stands, the governing container-padding record lists Card, Section, Dialog, and ScrollableArea as container publishers and does not admit BottomSheet, and the BottomSheet record is still a draft with no padding claim. What must be settled is BottomSheet's padding prop, the theme padding projection on bottom-sheet, and the released unpadded default. The pending spec proposal that admits BottomSheet as a container publisher is the natural place: once a maintainer approves and merges that admission (or points to a current claim that already settles those three points), this implementation can be re-reviewed without a code change on spec grounds alone. No code defect was found in this pass.
[Automated review]
kentonquatman
left a comment
There was a problem hiding this comment.
Looks good from the design side 👍
BottomSheet's content box resolves padding through container() the way
Dialog's does: the padding prop, then the theme's padding on
bottom-sheet (--astryx-bottom-sheet-padding*). With neither it keeps
the released unpadded default: the edge chains end at 0px and the
Layout inset chains have no terminal value, so a nested Layout keeps its
own default. The padded box publishes its inset, so a lone Section
child and bleed children such as Table and Divider align against it.
The panel stays the overlay boundary that resets inherited page
geometry.
- theming: container: true and padding -> expand: 'container', so a
theme's padding on bottom-sheet lowers to container tokens instead of
padding the panel.
- Storybook: ContainerPadding story (padding={4}, direct content,
full-bleed Divider).
2ce03f4 to
c740fad
Compare
There was a problem hiding this comment.
Thanks for making BottomSheet work like Dialog here. This reads ready to approve: the current container-padding spec now admits BottomSheet as a container publisher with the prop, then theme, then no-inset precedence this implements, and the preserved unpadded default checks out — the default sheet is unchanged against main in the browser comparison, while padding={4} applies and publishes a 16px inset that a full-bleed Divider escapes, with no accessibility violations. The focused BottomSheet, theme, Layout, Dialog, and Section tests also pass.
One note for theme authors, already in the docs and changeset: a theme's padding on bottom-sheet now insets the sheet content through container tokens instead of padding the panel, so any custom theme setting it should check the result. No code change is being requested.
[Automated review]
The scrolling content area becomes a container publisher, mirroring the BottomSheet container design (#6883): a padding prop on Dialog's spacing-step scale, theme padding on 'drawer' expanded to --astryx-drawer-padding* container tokens, and the released full-bleed default preserved — edge chains terminate at 0px and Layout inset chains have no terminal value, so an unthemed drawer is pixel-identical to before. The block-end edge adds the home-indicator safe area on top of the container inset in every mode, and the content area now paints the surface so a dark-mode inset ring in --shadow-high no longer changes the panel edge partway down (the #5305 treatment). A lone Section child escapes the inset, bleed children such as an isFullBleed Divider compensate against it, and a Layout inside picks it up for its header, content, and footer regions — verified in Chromium against the built Storybook, light and dark, including inset parity with the same Layout composition inside a Dialog. Core gains the drawer chains in container.stylex.ts, a drawer entry in derivedVarRegistry (doc source of truth lives in packages/lab), and Layout re-exports of the explicit-padding lowering maps that lab needs. Drawer.spec.md records the candidate contract (FR16/DEC-2, pending owner approval) and the open questions: the default inset, loose DrawerHeader compensation, and explicit-padding safe-area semantics.
User need
People building a mobile sheet want it to work like a Dialog. Today BottomSheet's content box has no padding and publishes no container inset, which causes three problems:
<Section padding={4}>, a VStack padded with a raw token string, or private body styles.paddingonbottom-sheetlands on the panel instead.Dialog already solves all three through container lowering. BottomSheet can do the same without changing the default every released sheet relies on.
Problem and solution fit
container()exactly as Dialog's does. The inset comes from thepaddingprop, then the theme'sbottom-sheetpadding, and the box publishes the inset it applies. With neither set, the box stays unpadded:0px.overlayPaddingReset, so page geometry still stops at the sheet.container: true,padding → expand: 'container') plus the registry entry, so themepaddinglowers to--astryx-bottom-sheet-padding*.paddingprop row and an updated Content-area anatomy.ContainerPaddingStorybook story.Current specification
#6882 records this decision, and it must merge first:
architecture:container-paddinglists BottomSheet as a container publisher with Dialog's projection: thepaddingprop, then the theme'spaddingonbottom-sheet, then no inset.component:BottomSheetFR4 records the Content area's inset and precedence, and that the released default is preserved.Public delta and caller burden
padding?: SpacingStep. It takes Dialog's spacing steps (0, 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10) and works on standalone and switcher sheets.components['bottom-sheet'].base.padding(and its longhands) now emits--astryx-bottom-sheet-padding*tokens that inset the content box. Before, it emitted raw padding on the panel. None of the bundled themes set this.Callers don't need to change anything.
Design and alternatives
The model is Dialog's container lowering, with no new mechanism. #6882 rejects keeping caller-owned padding, and rejects defaulting to
--spacing-4, which would double-pad released sheets and need a breaking change and a codemod.Evidence
Real Chromium at 390×844 (2×). I built Storybook from
mainand from this branch, opened each sheet, and compared the panels.0px/0px/ unset, same asmainmainmainmainmainNew behavior:
padding={4}(ContainerPaddingstory): text sits 16px in, the box publishes16px, and a full-bleed Divider spans the full 388px inner width.padding: '24px 20px', injected on an existing story: the content box pads 24px/20px and publishes 20px inline. The Layout insets read 20px/24px, the panel stays unpadded, and a lone Section escapes to the full width.ContainerPaddingstory (padding={4})Scope
Testing
BottomSheetPanel.test.tsx: the default chain publishes no inset, and its Layout insets have no fallback; explicit0and2are applied and published on all four edges; the panel stays unpadded.BottomSheet.test.tsx: the prop reaches the content box in standalone and switcher sheets.defineTheme.test.ts:bottom-sheetpadding expands to container tokens.derivedVarRegistry.test.ts: registry matches the docs.vitest runon BottomSheet, theme, Layout, Dialog, Section, DropdownMenu, Date/Time/DateTime inputs, MobileTokenizer, and codemods: 3,493 tests pass.pnpm check:repo,tscfor core and core docs, ESLint, Prettier, andcodemod-verify(nothing to verify).