Skip to content

feat(lab): Drawer is a container, like Dialog - #6885

Merged
imdreamrunner merged 1 commit into
mainfrom
feat/lab-drawer-container
Oct 9, 2026
Merged

imdreamrunner merged 1 commit into
mainfrom
feat/lab-drawer-container

Conversation

@imdreamrunner

@imdreamrunner imdreamrunner commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

User need

Drawer is a full-bleed panel. Dialog is a container: its content is inset by --spacing-4 (16px) by default, by its padding prop, or by a theme's dialog padding, and a Layout inside lines up DialogHeader, the body, and the footer on one content line with full-bleed dividers. Drawer has none of this, so there is no Drawer padding prop and no theme padding, and a Layout inside a Drawer doesn't line up the way it does inside a Dialog. This continues aligning Drawer with Dialog after #6877.

This PR also fixes a dark-mode edge bug a designer reported: the panel's edge changes partway down. The fix is on the same element as the container padding, so it ships here.

Problem and solution fit

  • Drawer becomes a container, exactly like Dialog.
    • The scrolling content area applies the inset and passes it to its children, below the dialog root, which keeps blocking padding inherited from the page.
    • New padding?: SpacingStep prop on Dialog's spacing scale.
    • A theme's padding on drawer becomes --astryx-drawer-padding* variables.
    • Default --spacing-4 (16px), as in Dialog. padding={0} gives a full-bleed content area.
  • Headers compose as in Dialog. DrawerHeader goes in a Layout header slot, the body in LayoutContent, and actions in LayoutFooter. The Layout cancels the drawer's inset and re-applies it to each region, so the header lines up with the body and isn't padded twice. The six docsite examples, the Storybook stories, and the doc snippets move from DrawerHeader + Section padding={4} to that composition.
  • Sandbox audit drawers get their close button back. The component-scores and template-audit pages still passed hasCloseButton, which feat(lab): align Drawer dismissal and close control with Dialog #6877 removed, so their non-modal panels had no visible close button (and the sandbox typecheck failed on main). They now compose DrawerHeader with onOpenChange in a Layout, keep the title as the focus target on open and on row switch, and reset the LayoutContent scroller when the selected row changes.
  • Safe area kept. The block-end padding is the container inset plus the home-indicator inset. Only the container inset is passed down, so a full-bleed child doesn't eat the safe area.
  • Dark-mode edge fix. The content area paints --color-background-surface. The bundled themes add a faint inner highlight to --shadow-high in dark mode. An opaque child such as Section painted over it beside the content, so the panel edge changed where the content ended. Painting the surface on the content area hides the highlight evenly and leaves the attached-side border as the one edge. BottomSheet already does this (fix(BottomSheet): give the sheet one uniform edge against the scrim #5305).

Current specification

  • architecture:container-padding (current) defines the container protocol. Drawer joins it exactly as Dialog does. That record still lists Dialog, Card, Section, and ScrollableArea as containers; adding Drawer to it is left to a separate record PR, the same split as BottomSheet's.
  • component:Drawer (draft) records the contract as DEC-2 (owner decision: Dialog's contract, including the --spacing-4 default and the Layout header composition) and FR16.

Public delta and caller burden

  • Lab: Drawer gains padding?: SpacingStep. Theme components.drawer.base.padding now pads the content area instead of being ignored.
  • Default change: a Drawer without padding now gets a 16px inset. Drawer is unreleased Lab, so there's no codemod. Callers either compose with Layout as Dialog does, or pass padding={0} to stay full-bleed.
  • Core (patch changeset):
    • drawer padding variable chains in container.stylex.ts, ending at --spacing-4 like Dialog's;
    • a drawer entry in derivedVarRegistry;
    • no new root exports: Lab imports the explicit-padding style maps from the existing @astryxdesign/core/Layout/padding.stylex subpath.
// Compose like Dialog: the Layout lines the header, body, and footer up on the drawer's inset
<Drawer isOpen={isOpen} onOpenChange={setIsOpen} label="Details">
  <Layout
    header={<DrawerHeader title="Details" onOpenChange={setIsOpen} />}
    content={<LayoutContent>...</LayoutContent>}
    footer={<LayoutFooter>...</LayoutFooter>}
  />
</Drawer>

Open questions (not blocking)

Evidence

  • Browser (Chromium, built Storybook, light and dark), 19 checks pass:
    • Default drawer (Showcase): content padding is 16px on every edge, the panel itself stays unpadded, the content area paints the surface, and the DrawerHeader title sits 17px from the edge (16px plus the 1px attached-side border), not 33px.
    • Layout inside a Drawer: title inset 17px, the same as in Dialog plus the border.
    • padding={6}: 24px inset, and an isFullBleed Divider spans the full panel line.
    • Theme drawer padding of 24px: it reaches the content area without a prop.
    • No page errors.
  • Sandbox audit drawers (Chromium, both pages), 23 checks pass: one header close button with an accessible name, focus on the title on open and after a row switch, title inset 17px, the content scroller reset on row switch, the close button closes the panel and returns focus to the page, and no page errors.
  • The drawer-close browser check (modal-close-visibility.js) passes for the modal, non-modal, and stacked stories.
  • Unit tests cover:
    • the default --spacing-4 chain on the edges and the Layout insets;
    • the passed-down vs applied inset with an explicit step;
    • the safe-area combination;
    • the panel staying unpadded.

Scope

  • One capability: Drawer as a container, like Dialog. The edge fix is on the same element and in the same style block.
  • Unrelated fixes, cleanup, and policy changes were removed or split. The architecture-record amendment is a separate PR.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Drawer, theme, Layout, Section, Dialog, Layer, and BottomSheet suites: 960 passed, 1 failed. The failure (useSheetGestures "promotes a pull-down from the top of a nested scroller") fails the same way on unmodified main. themingTargets: 421 passed.
  • pnpm -F @astryxdesign/docsite test: 580 passed, 6 skipped. The docsite, Storybook, and Lab docs typechecks pass.
  • pnpm build, docsite generation, pnpm check:knowledge, pnpm check:repo, and the Storybook build pass.
  • Sandbox: tests 35 passed. Its typecheck no longer reports the two hasCloseButton errors; the one remaining error (doc-preview/SectionRenderer.tsx) is unrelated and also fails on main.

Rebased onto main (now 9613feb). #6883 (BottomSheet container) is merged; its entries and Drawer's sit side by side in container.stylex.ts and defineTheme.test.ts.

@vercel

vercel Bot commented Oct 2, 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 8, 2026 11:10pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 2, 2026
@astracat-bot

astracat-bot Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 9, 2026, 12:03 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.

Thanks for the detailed proposal and evidence. The implementation reads cleanly and the behavior checks out — the default drawer is unchanged, an explicit padding value and a theme's drawer padding both reach the content area, and bleed children and Layout compositions align as described.

Approval needs a maintainer decision first: the current container-padding architecture does not yet admit Drawer as a container, and the Drawer record is still a draft, so a maintainer needs to provide or identify the governing spec for this addition (for example, approving the proposed container direction in the Drawer record and/or updating the container-padding record to list Drawer). The open choices you flagged — the default inset, the loose DrawerHeader composition under nonzero padding, and safe-area handling with an explicit padding — can be settled in that same decision.

No code changes are being requested for the missing spec itself. Once a maintainer settles the governing spec, this is ready for a final look.

[Automated review]

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB
@astryxdesign/lab N/A 3.8KB 1.6KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

24 of 442 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
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 155,733
Chat Full AI Chat probe dark 155,005
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,229
Chat With Attachments probe dark 11,065
TableRowExpansion Detail Panel neutral dark 5,129
TableRowExpansion Detail Panel neutral light 4,050
SideNav Resizable in AppShell probe dark 3,208
SideNav Resizable in AppShell probe light 3,208
TableGroupedRows Default neutral light 2,133
TableGroupedRows Default neutral dark 2,116
Markdown Default probe dark 897
Markdown Default probe light 897

and 4 more.


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

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

Thanks for the detailed proposal and evidence. The implementation reads cleanly and the behavior checks out — the default drawer is unchanged, an explicit padding value and a theme's drawer padding both reach the content area, and bleed children and Layout compositions align as described.

Approval needs a maintainer decision first: the current container-padding architecture does not yet admit Drawer as a container, and the Drawer record is still a draft, so a maintainer needs to provide or identify the governing spec for this addition (for example, approving the proposed container direction in the Drawer record and/or updating the container-padding record to list Drawer). The open choices you flagged — the default inset, the loose DrawerHeader composition under nonzero padding, and safe-area handling with an explicit padding — can be settled in that same decision.

No code changes are being requested for the missing spec itself. Once a maintainer settles the governing spec, this is ready for a final look.

[Automated review]

@imdreamrunner
imdreamrunner force-pushed the feat/lab-drawer-container branch 2 times, most recently from 044af64 to 846bb3d Compare October 8, 2026 21:05

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

Thanks for the detailed proposal and evidence. The behavior checks out as described: with nothing set, the drawer content is now inset by 16px like Dialog (a Layout inside keeps one content line, so the header isn't padded twice), an explicit padding and a theme's drawer padding both reach the content area, and a full-bleed Divider compensates against the published inset.

Approval needs a maintainer decision first: the current container-padding architecture doesn't yet admit Drawer as a container, and the Drawer record is still a draft, so a maintainer needs to provide or identify the governing spec for this addition — approving the proposed FR16/DEC-2 direction, including the new --spacing-4 default in place of the full-bleed default and the safe-area handling under an explicit padding, and/or updating the container-padding record to list Drawer. No code changes are being requested for the missing spec itself.

One correction to make in the meantime: three strings in the Drawer docs (the content-area anatomy line and its translation, and the compact description) still say the content area is unpadded by default — they should state the new --spacing-4 default, matching the padding prop entry in the same file.

Once the governing spec is settled and those strings are updated, this is ready for another look.

[Automated review]

@astracat-bot

astracat-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Looked at 66e9d9b: this push moves the two sandbox audit drawers to the Layout + DrawerHeader composition and drops their padding={0}; that matches the proposed contract. The open items from the previous review are unchanged at this head:

  • The Drawer record is still a draft (approved_by empty), and the container-padding architecture still lists no Drawer, so the governing decision is still pending with the maintainers; no code change is requested for that.
  • Drawer.spec.md ORD0 still says the inset resolves to "no inset" when nothing is set, while FR16, DEC-2 and the at-a-glance table say --spacing-4.
  • The Drawer docs still say the content area is unpadded by default (the content-area anatomy line and its translation).
  • packages/core/src/Layout/index.ts still re-exports the five padding-lowering maps, and packages/core/src/index.ts does export * from './Layout', so they become root exports of @astryxdesign/core. Lab can import them from the existing @astryxdesign/core/Layout/padding.stylex subpath instead (Drawer.tsx already deep-imports @astryxdesign/core/theme/tokens.stylex), leaving the core root surface unchanged.

[Automated review]

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

astracat-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Looked at 917be8a. The three code and record items from the earlier notes are resolved: Layout/index.ts is out of the diff and Drawer imports the padding-lowering maps from the existing @astryxdesign/core/Layout/padding.stylex subpath, so the core root surface is unchanged; Drawer.spec.md ORD0 now resolves to --spacing-4 like FR16 and DEC-2; and the content-area doc strings (including the translation) say the area is inset by --spacing-4 by default.

What still needs the maintainers is unchanged: the Drawer record is a draft (approved_by empty) and the container-padding architecture still lists no Drawer publisher, so the governing decision — Dialog parity with the --spacing-4 default, the Layout header composition, and safe-area handling under an explicit padding — is still theirs to record. No code change is requested for that.

[Automated review]

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

Thanks for the detailed proposal and evidence. The behavior checks out as described: with nothing set, the drawer content is now inset by 16px like Dialog (a Layout inside keeps one content line, so the header isn't padded twice — the migrated showcase renders identically before and after), an explicit padding and a theme's drawer padding both reach the content area, a full-bleed Divider compensates against the published inset, and the sandbox audit drawers have their close button back through the new composition.

Approval needs a maintainer decision first: the current container-padding architecture doesn't yet admit Drawer as a container, and the Drawer record is still a draft, so a maintainer needs to provide or identify the governing spec for this addition — approving the proposed FR16/DEC-2 direction, including the new --spacing-4 default in place of the full-bleed default and the safe-area handling under an explicit padding, and/or updating the container-padding record to list Drawer. No code changes are being requested for the missing spec itself, and no other defects were found in this round.

Once the governing spec is settled, this is ready for another look.

[Automated review]

@imdreamrunner
imdreamrunner merged commit 7189141 into main Oct 9, 2026
45 checks passed
@github-actions
github-actions Bot deleted the feat/lab-drawer-container branch October 9, 2026 06:25

This branch was successfully deployed

1 active deployment
Preview — 917be8a2 Deployed Oct 8, 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