Repository navigation
fix(core,lab): stop the container padding system at every overlay boundary - #5231
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
August 19, 2026 21:43
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBottomSheet (@astryxdesign/core) · View in Storybook
Dialog (@astryxdesign/core) · View in Storybook
Layer (@astryxdesign/core) · View in Storybook
Layout (@astryxdesign/core) · View in Storybook
Lightbox (@astryxdesign/core) · View in Storybook
MobileNav (@astryxdesign/core) · View in Storybook
Popover (@astryxdesign/core) · View in Storybook
Section (@astryxdesign/core) · View in Storybook
Drawer (@astryxdesign/lab) · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 2 accessibility violation(s) found — 1 serious, 1 moderate. Layout - 2 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
…ndary Follow-up to #5209, which zeroed --container-padding-* on four overlay roots and closed the visible overflow in #5208. Two gaps remained. The variables descendants ADD (--layout-padding-*, and a Section's propagated padding) still crossed the boundary, so an unpadded Section inside an overlay took the page's padding instead of the theme default — 40px where 16px was meant. And Lightbox, ContextMenu and HoverCard were never covered. The reset now lives in one place (overlayPaddingReset, exported from @astryxdesign/core/Layout) instead of being hand-copied per overlay, and moved onto the useLayer root, which covers every layer surface at once. Values descendants subtract are zeroed; values they add are cleared to initial so readers fall through to their own default rather than losing their padding. Section's padding propagation moved from the public --astryx-section-padding token to a private --_section-padding-propagated. The two carried different authority under one name — a theme's value versus one ancestor's — and an overlay could not drop the inherited one without blanking the theme's. Propagated values still win over the theme for nested sections, so behavior is unchanged.
imdreamrunner
force-pushed
the
fix/overlay-padding-var-isolation
branch
from
August 20, 2026 00:26
7486850 to
d4b04b1
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #5209. Stacked on it — the first three commits here are #5209's; this PR's own change is the last commit, and the diff cleans up once #5209 merges.
#5209 zeroed
--container-padding-*on four overlay roots and closed the visible overflow in #5208. Two gaps remained.1. Only half the leak was closed
The container padding system talks to descendants through inherited custom properties, but an overlay leaves its parent's visual box while staying a DOM descendant of it. Two families cross that boundary, and they pull in opposite directions:
--container-padding-*--layout-padding-*, section propagationSo after #5209 an unpadded
Sectioninside an overlay under<Section padding={10}>renders at 40px instead of the 16px theme default. Measured, before this PR:Zeroing these would be wrong — they're added, so
0pxstrips padding rather than restoring it. They're cleared toinitialinstead, which makes each guaranteed-invalid so readers fall through their ownvar(…, fallback)chain to the theme default. After this PR both columns read 16px.2. Three overlays were never covered
Lightbox(its own<dialog>), andContextMenu+HoverCard(they calluseLayerdirectly, sousePopover's surface reset missed them).Rather than hand-copy the block a seventh time, the reset moved to
useLayer's root — which covers every layer surface at once, includinghasSurface: falseconsumers that the surface style never reached — and is exported once asoverlayPaddingResetfrom@astryxdesign/core/Layoutfor the<dialog>-based overlays. Net: the four-line block goes from six hand-copied sites to one definition.The
--astryx-section-paddingsplitSectionpropagated its explicit padding on the public--astryx-section-paddingtoken, the same name themes set at the theme root. One name, two authorities — a theme's value and one ancestor's — so an overlay could not drop the inherited one without blanking the theme's inside every dialog.Propagation moved to a private
--_section-padding-propagated, read ahead of the public token, so a propagated value still wins over the theme for nested sections. No behavior change and themes are untouched:--astryx-section-paddingis still the public token and still reaches inside overlays. Verified in a browser — a theme's 20px reaches aSectioninside aDialognested under a 40px pageSection, while the 40px does not.Verification
Measured in Chromium against a built
@astryxdesign/core, each overlay open inside<Section padding={10}>(40px):--container-padding-inline-start--astryx-section-paddinginside a Dialogpackages/core/src/Layout/overlayPaddingReset.test.tsxcovers Dialog, BottomSheet, MobileNav, Lightbox and the layer surface. The tests discriminate: emptying the reset fails all 12.Full suite 530 files / 10,778 tests green;
pnpm lint:strictclean (56 pre-existing warnings);pnpm buildproduces no drift.Two jsdom limits worth knowing, both noted at the assertions: it echoes the
initialkeyword instead of resolving it to the guaranteed-invalid value, and it does not inherit custom properties — so the theme-token invariant is guarded at its source (the reset must not name the public token) and verified in a browser.