Skip to content

fix(BottomSheet): give the sheet one uniform edge against the scrim - #5305

Merged
imdreamrunner merged 2 commits into
mainfrom
bottom-sheet-edge
Aug 21, 2026
Merged

imdreamrunner merged 2 commits into
mainfrom
bottom-sheet-edge

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

The bottom sheet's edge against the scrim was wrong in dark mode in two ways.

1. Unthemed: no edge at all

The sheet separates itself from the scrim with its surface fill plus a --shadow-high drop shadow. In light mode that reads: white on a darkened page. In dark mode it does not — --color-background-surface is #1F1F22, the scrim resolves to about #111112, and the shadow is black on near-black.

Measured across the left edge in Chromium, sheet open:

scrim sheet boundary contrast
light 144,153,164 255,255,255 2.89:1
dark 16,16,18 31,31,34 1.16:1

Past 640px the sheet is centred at its max width, so the left and right edges are the whole outline.

2. Themed: an edge that changed width partway down

Every bundled theme packs an inset ring into --shadow-high for dark mode — neutral's is inset 0 0 0 1px oklch(1 0 0 / 15%), deliberately dark-only. An inset shadow paints above the element's own background but below its children, so an opaque content wrapper flush to the inner edge paints over it. Section — the wrapper the BottomSheet showcase and most real sheets use — has an opaque --color-background-surface background and does exactly that.

So the ring is hidden for as far as the content runs, then switches on in the empty area below it. Sampling the left edge on the docs site in dark mode:

outside edge just inside
above the content end 2,2,2 60,60,60 38,38,38
below the content end 2,2,2 60,60,60 71,71,71

A second light line appearing partway down, which reads as the border changing width.

Fix

  • A --border-width / --color-border hairline on the three scrim-facing edges. MobileNav, the other scrim-backed surface drawer, already does this on its scrim-facing edge; BottomSheet never picked it up. A border paints outside the padding box, where no child can reach. The block-end edge is left bare — it sits below the viewport under the overscroll padding.
  • The scrolling body paints the surface across the sheet's whole inner box, so a theme's inset ring is covered evenly instead of half-covered, leaving the border as the sheet's one edge. The body is the only in-flow child and fills the inner box; the floating handle bar is positioned, so it still paints above.

Result

Left and right edges sample identically above and below the content end, in dark and light, themed and unthemed. Light mode is unchanged to the eye — the hairline is a 10%-alpha ink on white.

Test plan

  • Two new BottomSheetPanel.test.tsx cases: the hairline on the three scrim-facing edges (and its absence on the block-end edge), and the body's surface fill. Negative control: deleting one of the three border declarations fails the first.
  • Verified by pixel sampling on the running docs site (neutral theme, dark and light, the real showcase content), and in a standalone harness with default tokens — WebKit and Chromium, DPR 1/1.25/1.5/2/2.625, zoom 90–150%, three viewport widths.
  • pnpm lint:strict (0 errors), vitest run packages/core packages/lab (7504), vitest run packages/cli apps (2801), pnpm build, the full build-storybook typecheck stack, and pnpm lab:readiness:check all pass.

Follow-up: the body-background half of this fix is a workaround, not a proper fix — the root cause is that themes pack the dark-mode inner ring into the shadow tokens, where any opaque child erases it. A component can't fix that locally. Filed as #5308 for discussion; the durable answer is likely a --surface-ring token applied as a border.

…dark mode

The sheet separated itself from the scrim with its surface fill and a
`--shadow-high` drop shadow. In light mode that reads: white on a
darkened page. In dark mode it does not. `--color-background-surface`
is #1F1F22 and the scrim resolves to about #111112, and the shadow is
black on near-black, so it adds no edge at all. Measured across the
sheet's left edge in Chromium at 1000px wide: 1.16:1 boundary contrast
in dark against 2.89:1 in light. Past 640px the sheet is centred at its
max width, so those left and right edges are the whole outline, and
they simply were not there.

Draw a `--border-width` / `--color-border` hairline on the three edges
that face the scrim. MobileNav, the other scrim-backed surface drawer,
already does exactly this on its scrim-facing edge; BottomSheet just
never picked it up. The block-end edge is left bare: it sits below the
viewport under the overscroll padding, so a border there would never
paint.

Light mode is unchanged to the eye (the hairline is a 10%-alpha ink on
white, invisible against the scrim step); dark mode now shows the top
corners and both sides.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Aug 21, 2026
@vercel

vercel Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview Aug 21, 2026 11:03pm

Request Review

@github-actions

github-actions Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

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

Bundle Size Summary

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

Accessibility Audit

Status: No accessibility violations detected.


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

github-actions Bot added a commit that referenced this pull request Aug 21, 2026
… ring

The hairline in the previous commit gave the sheet an edge against the
scrim, but it did not make that edge uniform. Every bundled theme packs
an inset ring into `--shadow-high` for dark mode -- neutral's is
`inset 0 0 0 1px oklch(1 0 0 / 15%)`, deliberately dark-only. An inset
shadow paints above the element's own background but below its
children, so an opaque content wrapper flush to the inner edge paints
over it. `Section`, the wrapper the BottomSheet showcase and most real
sheets use, has an opaque `--color-background-surface` background and
does exactly that.

The result: the ring is hidden for as far as the content runs, then
appears in the empty area below it. On the docs site, sampling the left
edge in dark mode gives `2,2,2 | 60,60,60 | 38,38,38` above the content
end and `2,2,2 | 60,60,60 | 71,71,71` below it -- a second light line
that switches on partway down the sheet and reads as the border
changing width.

Have the scrolling body paint the surface across the sheet's whole
inner box. It covers the ring evenly, and the border -- which paints
outside the padding box, where no child can reach -- is left as the
sheet's one edge, in themed and unthemed dark mode alike. Verified on
the docs site: the left and right edges now sample identically above
and below the content end in both modes.

The body is the only in-flow child and fills the inner box, and the
floating handle bar is positioned, so it still paints above.
@imdreamrunner imdreamrunner changed the title fix(BottomSheet): give the sheet a visible edge against the scrim in dark mode fix(BottomSheet): give the sheet one uniform edge against the scrim Aug 21, 2026
@imdreamrunner
imdreamrunner enabled auto-merge (squash) August 21, 2026 23:08
@imdreamrunner
imdreamrunner merged commit 66c3750 into main Aug 21, 2026
19 checks passed
github-actions Bot added a commit that referenced this pull request Aug 21, 2026
@github-actions
github-actions Bot deleted the bottom-sheet-edge branch August 22, 2026 06:09
imdreamrunner added a commit that referenced this pull request Oct 6, 2026
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.
imdreamrunner added a commit that referenced this pull request Oct 8, 2026
The scrolling content area becomes a container publisher with Dialog's
contract: a padding prop on Dialog's spacing-step scale, theme padding on
'drawer' expanded to --astryx-drawer-padding* container tokens, and a
--spacing-4 default shared by the edge and Layout inset chains, exactly as
in Dialog. Headers compose as in Dialog: DrawerHeader sits in a Layout
header slot, and the Layout redistributes the inset to its regions, so the
header lines up with the body and is not inset twice. The docsite blocks,
stories, and doc snippets move to that composition; padding={0} keeps a
full-bleed content area, which the two sandbox audit drawers use because
their details carry their own padding.

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

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 contract as DEC-2 (owner decision) and FR16.
imdreamrunner added a commit that referenced this pull request Oct 8, 2026
The scrolling content area becomes a container publisher with Dialog's
contract: a padding prop on Dialog's spacing-step scale, theme padding on
'drawer' expanded to --astryx-drawer-padding* container tokens, and a
--spacing-4 default shared by the edge and Layout inset chains, exactly as
in Dialog. Headers compose as in Dialog: DrawerHeader sits in a Layout
header slot, and the Layout redistributes the inset to its regions, so the
header lines up with the body and is not inset twice. The docsite blocks,
stories, and doc snippets move to that composition; padding={0} keeps a
full-bleed content area, which the two sandbox audit drawers use because
their details carry their own padding.

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

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 contract as DEC-2 (owner decision) and FR16.
imdreamrunner added a commit that referenced this pull request Oct 8, 2026
The scrolling content area becomes a container publisher with Dialog's
contract: a padding prop on Dialog's spacing-step scale, theme padding on
'drawer' expanded to --astryx-drawer-padding* container tokens, and a
--spacing-4 default shared by the edge and Layout inset chains, exactly as
in Dialog. Headers compose as in Dialog: DrawerHeader sits in a Layout
header slot, and the Layout redistributes the inset to its regions, so the
header lines up with the body and is not inset twice. The docsite blocks,
stories, and doc snippets move to that composition, and padding={0} keeps a
full-bleed content area.

The two sandbox audit drawers still passed hasCloseButton, which #6877
removed, so their non-modal panels had no visible close button. They now
compose DrawerHeader with onOpenChange in a Layout header slot, keep the
title as the focus target on open and on row switch, and reset the
LayoutContent scroller when the selected row changes.

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

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 contract as DEC-2 (owner decision) and FR16.
imdreamrunner added a commit that referenced this pull request Oct 8, 2026
The scrolling content area becomes a container publisher with Dialog's
contract: a padding prop on Dialog's spacing-step scale, theme padding on
'drawer' expanded to --astryx-drawer-padding* container tokens, and a
--spacing-4 default shared by the edge and Layout inset chains, exactly as
in Dialog. Headers compose as in Dialog: DrawerHeader sits in a Layout
header slot, and the Layout redistributes the inset to its regions, so the
header lines up with the body and is not inset twice. The docsite blocks,
stories, and doc snippets move to that composition, and padding={0} keeps a
full-bleed content area.

The two sandbox audit drawers still passed hasCloseButton, which #6877
removed, so their non-modal panels had no visible close button. They now
compose DrawerHeader with onOpenChange in a Layout header slot, keep the
title as the focus target on open and on row switch, and reset the
LayoutContent scroller when the selected row changes.

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

Core gains the drawer chains in container.stylex.ts and a drawer entry in
derivedVarRegistry (doc source of truth lives in packages/lab). Lab reads the
explicit-padding lowering maps from the existing
@astryxdesign/core/Layout/padding.stylex subpath, so the core root exports
are unchanged.
Drawer.spec.md records the contract as DEC-2 (owner decision) and FR16.
imdreamrunner added a commit that referenced this pull request Oct 9, 2026
The scrolling content area becomes a container publisher with Dialog's
contract: a padding prop on Dialog's spacing-step scale, theme padding on
'drawer' expanded to --astryx-drawer-padding* container tokens, and a
--spacing-4 default shared by the edge and Layout inset chains, exactly as
in Dialog. Headers compose as in Dialog: DrawerHeader sits in a Layout
header slot, and the Layout redistributes the inset to its regions, so the
header lines up with the body and is not inset twice. The docsite blocks,
stories, and doc snippets move to that composition, and padding={0} keeps a
full-bleed content area.

The two sandbox audit drawers still passed hasCloseButton, which #6877
removed, so their non-modal panels had no visible close button. They now
compose DrawerHeader with onOpenChange in a Layout header slot, keep the
title as the focus target on open and on row switch, and reset the
LayoutContent scroller when the selected row changes.

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

Core gains the drawer chains in container.stylex.ts and a drawer entry in
derivedVarRegistry (doc source of truth lives in packages/lab). Lab reads the
explicit-padding lowering maps from the existing
@astryxdesign/core/Layout/padding.stylex subpath, so the core root exports
are unchanged.
Drawer.spec.md records the contract as DEC-2 (owner decision) and FR16.

This branch was successfully deployed

1 active deployment
Preview — ffc89e64 Deployed Aug 21, 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.

1 participant