Repository navigation
feat(core)!: BottomSheet pads its content by default, like Dialog - #6884
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
2ce03f4 to
c740fad
Compare
6889918 to
d2f4eed
Compare
The bottom-sheet padding chain now terminates at --spacing-4 for both the
content edges and the Layout insets, matching Dialog. A sheet whose only
child is a padded Section renders as before; content that supplies its
own inset passes padding={0}.
- astryx upgrade: preserve-bottom-sheet-content-padding adds padding={0}
to BottomSheet elements that set no padding, except lone-Section sheets.
- In-repo sheets that pad themselves (touch date/time/date-time pickers,
MobileTokenizer, table templates) pass padding={0}; Storybook callsites
are the codemod's output; CLI example blocks drop hand-written padding.
- Changesets: core [breaking], cli [feat] for the codemod.
d2f4eed to
becd018
Compare
PR Analysis Report
|
rubyycheung
left a comment
There was a problem hiding this comment.
I reviewed this against the direction we discussed today. BottomSheet should have default content padding so direct content does not look broken against the panel edges.
This PR uses --spacing-4 on every edge, which is the current 16px spacing token, while still allowing theme overrides and padding={0} for edge-to-edge layouts. This matches the intended design. Approved.
Resolve transforms/next/index.mjs by registering all four next-release codemods, and the container padding comment to name bottom-sheet with the padded containers.
There was a problem hiding this comment.
The new BottomSheet default matches the current container-padding spec and the 0.7.0 breaking-change rules, but the astryx upgrade codemod needs a few fixes before this can merge. Please address the points below; each is small.
- Apps whose theme sets
paddingonbottom-sheetare unaffected by the new default, yet the codemod addspadding={0}to their sheets and removes that theme inset, so either skip that case or name it in the Migration line and the codemod description. - The codemod also edits a
BottomSheetthat a local parameter or variable shadows, so please reuse the Program-scope check fromtransform-prop.mjsand add a shadowed fixture. - Please add a second-run idempotence fixture (apply the transform twice and expect identical output), which the release-compatibility spec requires for codemods.
[Automated review]
|
|
||
| root.find(j.JSXElement).forEach((/** @type {any} */ elementPath) => { | ||
| const opening = elementPath.node.openingElement; | ||
| if (!nameMatches(opening.name, sheets, 'BottomSheet')) return; |
There was a problem hiding this comment.
This match compares names only, so a parameter or local const BottomSheet that shadows the core import still gets padding={0}. AST-040 FR1 requires a binding that is not shadowed at the edit site. The shared helper already does this check (transform-prop.mjs lines 91–95: jsxPath.scope.lookup(localName) must resolve to Program). Could you apply the same check here and to the Section/Layout child match, and add a shadowed fixture?
|
|
||
| A sheet whose only child is a padded `Section` or a `Layout` renders as before, because both escape the inset. Content that supplies its own inset is now padded twice: drop that inset, or pass `padding={0}` to keep the unpadded content box. `astryx upgrade` ships `preserve-bottom-sheet-content-padding`, which adds `padding={0}` where needed. | ||
|
|
||
| Migration: pass `padding={0}` to keep the unpadded content box, or drop your own inset to take the default; `astryx upgrade` adds `padding={0}` to every BottomSheet that sets no padding unless its only child is a padded Section or a Layout. |
There was a problem hiding this comment.
The new default leaves apps whose theme sets padding on bottom-sheet unchanged, but astryx upgrade adds padding={0} to their sheets, and the explicit prop overrides that theme inset. Could you name this case here and in the codemod description, or skip insertion when the project theme sets that padding?
| expect(output).toContain('<BottomSheet sheetId="b" label="B" padding={0}>'); | ||
| }); | ||
|
|
||
| it('leaves a sheet that already sets padding unchanged', async () => { |
There was a problem hiding this comment.
AST-017 FR8 asks codemods to ship a second-run idempotence fixture. An apply-twice test that covers insertion, spread placement, and the TODO case would satisfy it, as the sibling next codemods do.
…ndings, runs idempotently, names the theme-padding case
Review findings: a local parameter or variable named BottomSheet is no longer
edited (Program-scope check, as transform-prop.mjs does), a second run is
proven to change nothing, and the description and Migration line say that an
app whose theme sets bottom-sheet padding should drop the added padding={0}.
There was a problem hiding this comment.
The new BottomSheet default matches the current container-padding spec, and the codemod now handles the theme case, shadowed sheet bindings and idempotence, but one migration gap needs a fix before merge. astryx upgrade adds padding={0} with no TODO to a sheet whose content wraps a Layout that sets its own padding. That zeroes the Layout's inner region insets, so its header, content and footer lose the 16px between them.
- Flag every nested core
Layoutin the codemod, not only padding-less ones, and fix the TODO, because a Layout'spaddingrestores only its outer edges; then add a fixture and update both Changesets. - Smaller fixes: reuse
isModuleBindingfor the Section and Layout child matches, say the theme exception holds only when every edge is set, and update theContainerPaddingstory comment, which still describes the unpadded default.
[Automated review]
| const hasUnpaddedLayout = | ||
| j(elementPath) | ||
| .find(j.JSXOpeningElement) | ||
| .filter( | ||
| (/** @type {any} */ openingPath) => | ||
| nameMatches(openingPath.node.name, layouts, 'Layout') && | ||
| !(openingPath.node.attributes ?? []).some( | ||
| (/** @type {any} */ attribute) => | ||
| attribute.type === 'JSXAttribute' && | ||
| attribute.name?.name === 'padding', | ||
| ), |
There was a problem hiding this comment.
padding={0} also sets the sheet's inner Layout insets (--layout-padding-inner-*) to 0, and a Layout's own padding writes only --layout-padding-own-outer-*. A sheet whose content wraps <Layout padding={4} header={...} content={...} footer={...} /> therefore gets padding={0} with no TODO, and its regions lose the 16px between them (header-to-content text gap 17px → 1px in Chromium; without the codemod the new default left that sheet unchanged). Could this flag every nested core Layout, with a fixture for the padded case? The TODO's "Give that Layout an explicit padding" also restores only the outer edges, so its advice needs the same correction.
| children[0].type === 'JSXElement' && | ||
| (nameMatches(children[0].openingElement.name, sections, 'Section') || | ||
| nameMatches(children[0].openingElement.name, layouts, 'Layout')) |
There was a problem hiding this comment.
Minor: this match, and the nested-Layout check below, still compare local names only. When a parameter or local shadows the core Section import, the sheet is skipped and picks up the 16px default around content that may pad itself. Could both reuse isModuleBinding, with a shadowed-child fixture?
|
|
||
| A sheet whose only child is a padded `Section` or a `Layout` renders as before, because both escape the inset. Content that supplies its own inset is now padded twice: drop that inset, or pass `padding={0}` to keep the unpadded content box. `astryx upgrade` ships `preserve-bottom-sheet-content-padding`, which adds `padding={0}` where needed. | ||
|
|
||
| Migration: pass `padding={0}` to keep the unpadded content box, or drop your own inset to take the default; `astryx upgrade` adds `padding={0}` to every BottomSheet that sets no padding unless its only child is a padded Section or a Layout. An app whose theme already sets `bottom-sheet` padding is not affected by the new default; the codemod cannot see the theme, so remove the `padding={0}` it adds there to keep the theme inset. |
There was a problem hiding this comment.
Minor: this holds only for themes that set every edge. A theme that sets only paddingInline on bottom-sheet emits just --astryx-bottom-sheet-padding-inline, so its block edges now fall to --spacing-4 instead of 0. Maybe "whose theme sets bottom-sheet padding on every edge"?
…s its between-region inset
A Layout's own padding restores only its outer edges; the inset between its
regions comes from the sheet's container chain, which padding={0} zeroes, so
every nested core Layout gets the TODO (a Layout from another package or a
shadowed binding does not). The child Section/Layout exemption also checks
the module binding. The theme exception is stated for every-edge padding, and
the ContainerPadding story comment describes the padded default.
There was a problem hiding this comment.
No blocking issues remain: the new BottomSheet default matches the current container-padding spec, and the astryx upgrade codemod now flags every nested Layout, checks the Section and Layout bindings, and states the theme case precisely. Two optional follow-ups: a fixture for a shadowed Section or Layout child, since the test named for that case only covers a Layout from another package, and a Changeset mention of themes that pad only some bottom-sheet edges, whose other edges now gain the default inset.
[Automated review]
| ); | ||
| }); | ||
|
|
||
| it('does not flag a Layout from another package or a shadowed Layout binding', async () => { |
There was a problem hiding this comment.
Optional: this case imports Layout only from another package, so the shadowed-binding half of the title is not exercised. A fixture where a parameter shadows the core import, for example function A({Layout}) { return <BottomSheet isOpen><VStack><Layout content={x} /></VStack></BottomSheet>; } (expect padding={0} and no TODO), plus one for a shadowed Section child (expect padding={0}), would cover the isModuleBinding checks on the child and nested-Layout matches.
|
|
||
| A sheet whose only child is a padded `Section` or a `Layout` renders as before, because both escape the inset. Content that supplies its own inset is now padded twice: drop that inset, or pass `padding={0}` to keep the unpadded content box. `astryx upgrade` ships `preserve-bottom-sheet-content-padding`, which adds `padding={0}` where needed. | ||
|
|
||
| Migration: pass `padding={0}` to keep the unpadded content box, or drop your own inset to take the default; `astryx upgrade` adds `padding={0}` to every BottomSheet that sets no padding unless its only child is a padded Section or a Layout. An app whose theme already sets `bottom-sheet` padding on every edge is not affected by the new default; the codemod cannot see the theme, so remove the `padding={0}` it adds there to keep the theme inset. A sheet whose content wraps a `Layout` gets a TODO: `padding={0}` also removes the inset between that Layout's regions, which the Layout's own `padding` does not restore. |
There was a problem hiding this comment.
Optional: a theme that pads only some bottom-sheet edges (for example paddingInline) is affected too. Its other edges go from 0 to --spacing-4, and the codemod's padding={0} replaces the theme's own edges as well, so naming that case here would tell those apps to review both.
…docs (#7372) ## User impact Builders reading DateInput's API reference could not find `containerClassName`, `containerStyle`, `controlClassName`, or `controlStyle`, even though DateInput accepts them and they are the only class-name and inline-style hooks it has after root styling was removed. The English, Chinese, and dense references now list all six part-styling props, like the other field components. The draft contract now matches DateInput's current behavior. Runtime behavior does not change. ## Audit scope - Package/component: `core/DateInput` - Base: `1e883f86e7aa5c2be376671f746d79e5cfae769b` - Frozen head: `4faee79d299c5f4661bfecbb01a7aade966440ee` - Mode: Night Watch whole-component audit · Rubric: **1.16.6** - Runtime/API changes: none (API reference, draft contract, and a `[docs]` Changeset) - Landing: held until the 0.7.0 release is tagged. ## Score - Before: **85.6 / C** — 2 open BLOCKs; §5b not measured. - After: **87.3 / C**, confirmed by the exact-head checks — the same 2 BLOCKs, both owned by open contributor pull requests (see Needs Review). - Sensitivity: resolve the 2 open BLOCKs and change nothing else → **99.0 / A**. - Sections §1, §2, §3, §4, §5a, §5b, §6, §7, §8, §9, §10 — before `3, 5, 5, 3, 5, nm, 5, 5, 4, 5, 4`; after `3, 5, 5, 3, 5, nm, 5, 5, 5, 5, 4`. ## Findings | ID | Section | Finding | Authority | Result | |---|---|---|---|---| | D1 | §1 A5 — BLOCK | In the bottom-sheet calendar, the month arrows become natively disabled at the first or last reachable month, so a keyboard user who steps onto that month loses focus to the document. | `architecture:interaction-modality`; WCAG 2.2 SC 2.4.3 | **Open.** #6304 already fixes it; not duplicated here. | | D2 | §4 B15 — BLOCK | After a clear, the pointer surface passes `undefined` to Calendar, which treats it as uncontrolled, so reopening the calendar shows the cleared date as selected. A focused test at the exact head reproduces it: one day stays selected after clear and reopen. | DateInput clear contract (FR1, FR11); Calendar's documented controlled-empty `null`; WCAG 2.2 SC 4.1.2 | **Open.** #6935 already fixes it; not duplicated here. | | D3 | §8 X5b — FIX | The API reference omitted `containerClassName`, `containerStyle`, `controlClassName`, and `controlStyle`, which DateInput accepts under `family:input-fields/FR10`; the other field members list them. | `family:input-fields/FR10`; rubric X5b | **Fixed** in the English, Chinese, and dense references. | | D4 | §8 — FIX | The draft contract described the removed `date-input-clear-icon` alias and did not cite the FR10 base-prop and part-styling rule DateInput now follows. | Current source; `family:input-fields/FR10` | **Fixed.** The contract cites FR10 and the current clear-glyph target; the FR10 suite joins `verified_by`. No new component requirement is added. | Not scored: the bottom-sheet surface inherits BottomSheet's recorded shared-dismissal adoption gap (owned by BottomSheet under `family:overlay-dismissal`). The bottom-sheet calendar's day cells fade their colors without a reduced-motion collapse, but the motion record is still a draft, so no current authority applies. ## What changed - `DateInput.doc.mjs` — four props entries in `docs` and `docsZh`, four `docsDense` descriptions, matching the sibling field components. - `DateInput.spec.md` (draft) — cites `family:input-fields/FR10` in the governing rules and the family relationship, adds `DateInput.fr10.test.tsx` to `verified_by`, and names the current clear-glyph target. - `.changeset/date-input-part-style-props-docs.md` — `[docs]` patch, because the API reference ships in the package. ## Evidence - This PR changes no behavior, so no new functional test was added; typed docs validation and the doc-prop suites cover the docs change. - Exact-head checks on `4faee79`: CI run 38256902974 succeeded, including build, lint, unit tests, docsite tests, and the Storybook build. - `pr-a11y` audited all 26 DateInput stories: 0 violations and no new baseline entries. - `pr-rtl` (core): `core/DateInput` passes the automatic check and its curated calendar/clear control-order check. - Stable visual regression: see Visual acceptance. - Owner-exempt `review-required` is success on `4faee79`, set by GitHub Actions through the repository's Review signal workflow. `spec-owner-approval` is success (draft record only), and the CLA check passes. - A private review of the exact head, title, and description is clean. - Local runs on the first head: DateInput, doc-prop, and theming suites — 757/757; `typecheck:docs`; `pnpm build`; docsite generate and tests — 620 passed, 6 skipped; `check:knowledge`; `check:changesets`. Later commits changed only draft-contract text, with `check:knowledge` re-run after each, plus one empty commit that retriggered a failed preview deployment. - No local browser result is credited; browser evidence comes from the exact-head checks above. ## Closed evidence inventory | Surface | Evidence | Result | |---|---|---| | Controlled ISO value, typing, constraints, formats | source; focused suites | pass | | Five presentation values and deprecated mapping | `Presentation.test.tsx`; native and touch suites | pass | | Pointer calendar open, select, close | source; tests; `OpenCalendarAudit` story | pass | | Clear and calendar selection | source; focused test at the exact head | open — D2 | | Bottom-sheet calendar, wheels, save | `DateInputTouch.test.tsx` | pass | | Bottom-sheet month arrows at a bound | source | open — D1 | | Native picker, Action, clear, focus continuity | `NativeDateField.test.tsx` | pass | | Field states, status, disabled reason, InputGroup | focused suites; `AllVariations` | pass | | FR10 base props and part styling | `DateInput.fr10.test.tsx`; `StylingParts` story | pass | | API reference completeness | `DateInput.doc.mjs` | fixed — D3 | | Theming targets | `themingTargets.test.ts`; themed stories | pass | | Accessibility and RTL | exact-head `pr-a11y` (26 stories) and `pr-rtl` (core) | pass | | Narrow viewport and coarse pointer pixels | none | not measured | ## Visual acceptance Product visual delta: **N/A**. The change is limited to the API reference, the draft contract, and a Changeset; no component source, style, story, or rendered output changes. The exact-head stable visual gate passed with verdict `changed`: 448 shots, 356 unchanged, 42 changed, 50 added, 22 removed, 0 failed, against a baseline captured on 2026-09-26. #7370's exact-head report, from a PR that changed no DateInput file, lists the same 42 changed, 50 added, and 22 removed shots. 41 changed shots match it pixel for pixel; the 42nd, a SideNav resize shot, also varies between runs of this PR. No DateInput shot changed: its 8 added and 2 removed shots appear identically in #7370's report. The verdict reflects baseline drift, not this PR. ## Knowledge overlap search - Terms: `component:DateInput`, `DateInput.spec.md`, `containerClassName`, `controlClassName`, `FR10`, `date-input-clear-icon`, plus the path `packages/core/src/DateInput/`. - Canonical owner: the existing draft `component:DateInput` at `packages/core/src/DateInput/DateInput.spec.md`; the FR10 rule stays with `family:input-fields` and is linked, not copied. - Overlapping open work inspected: #6935 and #6304 own D2 and D1; #7358 changes translator imports; #6884, merged after this audit's base, changes only the bottom-sheet padding in `TouchDateField.tsx`; #6133 and #5939 are drafts. None edits `DateInput.spec.md`. DateRangeInput, DateTimeInput, and TimeInput carry the same API-reference gap; that is outside this audit. ## Review feedback - Automated review asked that the contract not restate part of `family:input-fields/FR10` and then that it not add a draft requirement that no current spec states. The contract now only cites FR10; the earlier FR13 row and its verification row are removed. The automated review approved the final head. ## Needs Review - **D1** — focus at the bottom-sheet month bounds: owned by #6304. - **D2** — stale calendar selection after clear: owned by #6935. - **Merge timing** — held until the 0.7.0 release is tagged. ## Writing rubric results - R1 narration: none; the contract states current behavior. - R2 research: none. - R3 evidence: facts and standards, not changes. - R4 rejected alternatives: none. - R5 change references: none. - R6 open questions: none. ## FR10 exact-head report ```json { "schemaVersion": 1, "component": "DateInput", "package": "core", "mode": "night-watch", "rubricVersion": "1.16.6", "repositoryBase": "1e883f86e7aa5c2be376671f746d79e5cfae769b", "repositoryHead": "4faee79d299c5f4661bfecbb01a7aade966440ee", "componentContractHead": "4faee79d299c5f4661bfecbb01a7aade966440ee", "inventory": {"closed": true, "rows": 13}, "score": {"before": 85.6, "after": 87.3, "beforeBlocks": 2, "afterBlocks": 2}, "unresolvedObjectiveGaps": [{"id": "D1", "rule": "A5", "owner": "#6304"}, {"id": "D2", "rule": "B15", "owner": "#6935"}], "unresolvedManualGaps": [], "remediations": [ {"id": "D3", "state": "verified-source", "evidence": "six part-styling props listed in all three references"}, {"id": "D4", "state": "verified-source", "evidence": "draft contract cites FR10 and names the shared clear glyph target"} ], "approvals": {"privateExactHeadSelfReview": "clean", "reviewSignal": "success (GitHub Actions)", "specOwner": "draft record only"}, "checks": {"local": "green; no local browser", "exactHeadCI": "success (run 38256902974)", "a11y": "0 violations across 26 owned stories", "rtl": "automatic and curated checks pass", "visual": "N/A product delta; gate drift matches an unrelated PR"}, "eligibility": {"eligible": false, "reasons": ["FR11 auto-merge inactive", "two open BLOCKs owned by contributor pull requests", "held until the 0.7.0 release is tagged"]} } ```
User need
#6883 makes BottomSheet a container like Dialog but keeps its released unpadded default. Content placed directly in a sheet therefore still sits flush against the panel edges, and every sheet has to opt in to the inset Dialog gives by default. Matching Dialog's default makes the two overlays interchangeable: the same content renders with the same inset in a Dialog on desktop and in a BottomSheet on a phone.
Problem and solution fit
--spacing-4for both the content edges and the Layout insets, exactly like Dialog's.preserve-bottom-sheet-content-paddingcodemod forastryx upgrade.padding={0}.verify-codemodschecks.[breaking]and codemod changesets.Current specification
The default change needs the spec amendment in #6938. It sets the Content area's inset to the
paddingprop, then the theme'spaddingonbottom-sheet, then--spacing-4, and marks the default as breaking withpadding={0}as the migration. Everything else comes from #6882.Public delta and caller burden
--spacing-4and publishes that inset. Before, it had no padding.Sectionor aLayout, because both escape the inset. Sheets that already setpadding, or whose theme sets it, are unaffected.padding={0}.Migration:
astryx upgradeaddspadding={0}to every BottomSheet that sets no padding, except sheets whose only child is a core Section or Layout. It placespadding={0}before any spread, so a spreadpaddingstill wins.padding={0}also sets a nested padding-less Layout's region padding to 0, so such a sheet additionally gets a TODO comment to review.Design and alternatives
This is Dialog's default, with no new mechanism. The alternative is #6883 on its own, which leaves sheets unpadded by default.
Evidence
Real Chromium at 390×844 (2×). I built Storybook from
mainand from this branch, opened each sheet, and compared the panels.MenuBottomSheet's Section escapespadding={0}(codemod)padding={0}(codemod)padding={0}(codemod)Scope
Testing
BottomSheetPanel.test.tsx: the default chain ends at--spacing-4for the edges and the Layout insets.vitest runon BottomSheet, theme, Layout, Dialog, Section, DropdownMenu, Date/Time/DateTime inputs, MobileTokenizer, and codemods: 3,500 tests pass.pnpm check:repo,tscfor core, core docs, lab, and CLI template docs, Prettier, andcodemod-verify(3/3 reproducible).Brought to mergeable for 0.7.0 (maintainer, 2026-10-12)
mainmerged in (two conflicts: the next-release codemod registry now lists all four transforms; the container-padding comment names bottom-sheet with the padded containers). Ivor's commit and credit are preserved.The
[breaking]core Changeset gains its Migration line (padding={0}keeps the unpadded content box;astryx upgradeadds it where needed); the[feat]CLI Changeset for the codemod stays.check:changesetspasses on the declared 0.7.0.component:BottomSheetalready describes this change (DEP-0009 / CLN-0018 as description); this change does not edit the record.Verification on the merged head: BottomSheet, Layout, Dialog, touch date/time and MobileTokenizer suites 848/848; next-release codemod suites 79/79; build-css and theme build 65/65;
tscclean.Real Chrome 155 before/after on
core-bottomsheet--container-paddingwithpaddingunset,padding={0}andpadding={4}, at 390px and 1280px, light and dark: the default inset goes from 1px to 17px (16px =--spacing-4);padding={0}reproduces the previous geometry exactly;padding={4}is unchanged; the full-bleed divider still spans the sheet. Private evidence: https://artifacts.internalmeta.com/a/1419210823699838Review follow-up (second round): every nested core
Layoutinside a sheet now gets the TODO, with or without its ownpadding, because a Layout'spaddingrestores only its outer edges while the inset between its regions comes from the sheet's container chain thatpadding={0}zeroes; a Layout from another package or a shadowed binding is not flagged. The Section/Layout child exemption also checks the module binding, the theme exception is stated for every-edge padding, and theContainerPaddingstory comment describes the padded default. Both Changesets say so. 12/12 codemod tests.