Repository navigation
feat(layer): the layer runtime owns the viewport inset (spec:AST-059) - #6919
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
October 3, 2026 19:25
Contributor
PR Analysis Report
Modified ComponentsPopover (@astryxdesign/core)
PowerSearch (@astryxdesign/core)
Toast (@astryxdesign/core)
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. PowerSearch - 1 issue(s)
Visual Regression15 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 | View full report |
8 tasks done
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 3, 2026 20:08
b7bd6bd to
9029099
Compare
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 3, 2026 20:22
79a7da9 to
7f2d739
Compare
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 3, 2026 23:33
7ed1f56 to
756381e
Compare
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 4, 2026 00:15
8d85380 to
6656d9d
Compare
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 4, 2026 00:52
6656d9d to
06ab139
Compare
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 4, 2026 02:06
9f3936d to
cff2db4
Compare
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 4, 2026 11:28
df9ad70 to
2973e18
Compare
One gutter definition in Layer/layerViewportInset.stylex.ts, read by useLayer for every anchor-mode layer (block cap, far-edge gutter) and by Popover, DropdownMenu, DropdownMenuSubMenu, BaseTypeahead and PowerSearch for their own clamped sizes. The span cap (calc(100% - gutter)) is gone: an explicit width renders at its size up to the viewport. An aligned layer whose anchor leaves the viewport is pinned unsafe toward its anchor so it holds position and size instead of sliding to the edge.
…pover records for spec:AST-059 Nine Core/Layer stories, one per claim, registered in the story play guard for real-Chromium geometry. Popover's ViewportFit story is replaced by them. The architecture record gains the viewport-inset section and INV11; the Popover record gives up FR3 and ORD3 and keeps its preferred size.
…ers and toasts The provider carries the inset as custom properties on a box-less wrapper; anchored layers read them through the gutter and the toast viewport sits at them, so one declaration clears one bar for both. Zero by default, so a surface with no provider renders as one under a default provider; toast.inset stays as the per-edge toast override (spec:AST-059 FR6, DEC-5).
…text; the first frame is the settled frame The layer box is capped to the viewport on the inline axis too, so a 1000px layer on a phone stays on screen and its content overflows inside (FR2). LayerProvider publishes the inset through context and useLayer writes it inline on the layer, so a corrective portal cannot lose it and no measurement applies it. Anchor visibility is read synchronously before first paint (FR8). Fourteen Core/Layer stories, each asserting the first painted frame equals the settled one, run at 1280x900 and 390x844; a draggable playground story for exploration.
… the playground readout settles The synchronous anchor-visibility read set state on every open even when the answer was already true, costing Tokenizer's search one extra commit. The playground's readout re-rendered itself on every commit.
…s hold at phone width The placement-axis gutter and a declared bar were only a size cap: a layer that fit below its trigger could end under the bar. The gutter is now an inset on the far edge of the position-area region, carried by named @position-try options for the placement-axis flip (a flip tactic would mirror it onto the wrong edge), with a span-all last resort for content no side can hold. Story fixtures place the trigger above the bar; the flip and return assertions account for a phone where neither side fits.
…ition-try rules The build pipeline mangles @position-try output (the sandbox build failed on the CSS), so the placement-axis positional gutter is a flip-mirrored inset carrying the larger of the two block gutters, and the span last resort is withdrawn. Records state the consequence.
… anchor clearance Insets did not bound position in Chromium; margins do — the margin box is what a position option must fit and what the overflow shift keeps inside the viewport. The clearance rides the anchor-facing edge and the gutter the far edge; a flip tactic swaps them with the area. Failure messages now carry the layer's computed geometry.
… for its subtree Storybook mounts the root provider, so a story's provider is nested; a nested provider was a no-op and no inset reached the stories' layers. One declaring an inset now provides it to the anchored layers in its subtree; the toast viewport stays the root's. The slide-then-return case at phone width is recorded as a verification gap rather than asserted.
…it above the bar A layer with no offset carries only the far-edge gutter (a static class), so a consumer's flush overlay sees no clearance variable, as before. The Selector and ComplexSelector clearance tests describe the new shape: the clearance rides the anchor-facing edge and a flip carries it across. The portaled story's provider now wraps the component that calls useLayer.
…he inset-change stories
…ill flips on the placement axis A layer wider than the room beside its trigger on both sides overflowed every flipped option on the alignment axis, so Chromium kept the base option and the layer never flipped above a trigger near the bottom. Each fallback list now ends with span-all options, same side first; the alignment-axis gutter rides both edges as margins with a negative inset on the anchor-facing edge so the aligned edge still meets the trigger and a slid layer keeps both gutters. Two block-axis stories join the guard.
…ication rows The one delta to the merged record from the block-flip fix: FR4 states the slide as a position option a layer wider than both sides still reaches, and the verification table gains the two block-axis stories.
cixzhang
force-pushed
the
layer-viewport-inset-runtime
branch
from
October 4, 2026 11:37
2973e18 to
36f20eb
Compare
…d once per document A plain position-area fallback keeps the base margins, which belong to an edge-aligned layer; and uniform margins and insets cannot place a slid layer 16px from the viewport edge while keeping an aligned layer's edge on its trigger. Each slide option therefore carries its own declarations — the gutter on both alignment-axis edges and the clearance/gutter pair of the side it lands on — as a static style sheet the runtime installs in the document head before first paint (StyleX positionTry() output is malformed in the pinned release). The sheet is not inside the layer, whose text would name it to assistive technology, and not beside it, where it would change a parent's last child.
Contributor
Author
|
/approve-spec cac226c |
cixzhang
marked this pull request as ready for review
October 6, 2026 14:25
cixzhang
enabled auto-merge (squash)
October 6, 2026 14:25
4 tasks done
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.
#6916 (
spec:AST-059) has landed ascurrent; this PR carries one post-merge record delta (FR4 states the slide as its own option; two block-axis verification rows) beside the implementation. Implements the record, moves the viewport stories to Layer, and amends the twocurrentrecords the record names.User need
A person who opens a 352px menu from a control near a panel edge gets a 274px one today, because an aligned layer's inline size is capped to the span of viewport beside its trigger. A long menu on a phone is squeezed beside its trigger instead of keeping its labels readable. An app with a floating navigation bar has no way to tell Astryx layers the bar is there. Four components each carry their own copy of the viewport gutter, and the copies have drifted.
Problem and solution fit
spec:AST-059DEC-1): one gutter definition inLayer/layerViewportInset.stylex.ts, read byuseLayerfor every anchor-mode layer — the block cap on the layer box and the far-edge gutter of the alignment axis — and by Popover, DropdownMenu, DropdownMenuSubMenu, BaseTypeahead and PowerSearch for the sizes they clamp.calc(100% - gutter)is gone everywhere. An explicitwidth/menuWidthrenders at its size up to the viewport (FR2); a content-sized layer wraps to the room beside its trigger when it can and flips when it cannot (DEC-2). No branch on whether a size was given.IntersectionObserverwhile open — the layer's self-alignment is pinnedunsafetoward the anchor so it holds its position and size instead of sliding to the edge (FR5, owner ruling 2026-10-03).insetonLayerProvider(blockStart,blockEnd,inlineStart,inlineEnd; zero by default) (FR6). The provider publishes it through context;useLayerwrites it inline on the layer as--astryx-layer-inset-*and the toast viewport writes the same on itself, so one bar is declared once for both (DEC-5) and a corrective portal cannot lose it.toast.insetstays as the toast-only per-edge override and still wins (inline style). A nested provider that declares an inset narrows it for the layers in its subtree (Storybook mounts the root provider, so stories need this; an app hosted inside another provider does too). App configuration, not a theme value; nolayertheme target (DEC-4). INV10 stays true: nothing resolves placement through the provider.@position-tryoptions (whole-axis span, same side then opposite) carrying the gutter on both alignment-axis edges and the landing side's clearance/gutter pair; no uniform margin/inset set can do that (an aligned edge on the trigger and a slid layer 16px from the viewport edge are contradictory with shared declarations). The 24 static rules are installed once per document head before first paint —stylex.positionTry()emits malformed CSS in the pinned release; inside the layer the text would be read as its accessible name (the InputClearButton tooltip test caught it); beside it, it changed parents' last child (ButtonGroup).Current specification
spec:AST-059(#6916,draft). This PR applies the deltas it lists toarchitecture:layer-runtime(viewport-inset section, INV3, new INV11, owning code, verification) andcomponent:Popover(FR3 and ORD3 retired, ORD2 clamps rather than caps, ownership boundary, verification map). Both arecurrent, so this PR waits onspec-owner-approvalat its exact head.Public delta and caller burden
LayerProvider.inset(LayerInset, exported). Unset → released geometry, with or without a provider (the default-provider and no-provider cases render identically, asserted inLayerProvider.test.tsx). The custom properties it emits are mechanism, not API.ToastViewportpositions itself atvar(--astryx-layer-inset-*, 0px)instead of0; an existingtoast.insetis unchanged in effect.Popover.widthstrings that are lengths are now clamped to the viewport (previously "used as-is" under the span cap).useLayeranchor-mode andusePopoverconsumer (FR7): Tooltip, HoverCard, ContextMenu, the selector family, TopNav menus, date inputs gain the gutter, the block cap, and the flip/hold behavior. A layer that already fit is unchanged.Design and alternatives
flip-inline(the submenu already records this). Consumers cap their painted surface with the runtime's expression instead.span-allfallbacks passed from Popover (fix(popover): an explicit width is capped by the viewport, not the span beside the trigger #6688) — crosses the ownership boundary and extends sliding to an anchor nobody can see.Evidence
Core/Layer"Viewport inset" stories, one per claim, each asserting the first painted frame equals the settled one, run by the story play guard at 1280×900 and 390×844 (28 runs): content fits beside the trigger; content does not fit (flips where it fits the viewport, capped where it does not); explicit 352px near an edge; trigger near an edge flips (slides on a phone); neither side fits (1000px slides on desktop, capped to 358px on a phone); taller than the viewport; anchor leaves the viewport; anchor already off-screen at open; app-declared inset (160px bar); inset changes while open; layer opens as the inset arrives; inset measured by the app; layer portaled out of its JSX position; the gutter at a flush edge; trigger near the bottom flips above; wide layer, trigger near the bottom (690px — Cindy's phone case). Plus a draggable playground (not evidence).LayerProvider.test.tsx: default provider emits no declaration; one property per declared edge; the anchored layer and the toast viewport both sit under the declaring wrapper;toast.insetoverrides per edge.layerViewportInset.test.tsscanspackages/core/srcfor a second gutter definition or a100%-of-span cap;useLayer.test.tsxcovers the per-placement gutter classes and the anchor-observer gate; Popover, DropdownMenu, SubMenu, PowerSearch suites assert the clamp strings.env(safe-area-inset-*)— a device run is owed (record, verification table).ViewportFitstory is replaced by the Layer stories;MatchTriggerViewportFitstays (trigger matching is Popover's preference). Expect the visual-regression report to show that removal.Writing rubric results
Records touched:
docs/architecture/layer-runtime.md,packages/core/src/Popover/Popover.spec.md(bothcurrent), andspec:AST-059(phaseonly; its own pass is on #6916).Scope
Testing