Repository navigation
fix(core): keep anchored layers on screen when their trigger runs past the viewport - #12307
josephfarina wants to merge 8 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| CommandPalette | 80.3 kB (+1.2 kB) · 13.1 kB CSS (+275 B) | — | — · — · — |
| PowerSearch | 311.6 kB (+322 B) · 26.1 kB CSS (+300 B) | — | — · — · — |
| ListItem | 80.3 kB (+292 B) · 12.5 kB CSS (+311 B) | — | — · — · — |
124 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| CheckboxListItem | 81.2 kB (+287 B) · 12.5 kB CSS (+311 B) | — | — · — · — |
| StatusDot | 34.4 kB (+313 B) · 5.7 kB CSS (+281 B) | — | — · — · — |
| Tooltip | 32.8 kB (+310 B) · 4.8 kB CSS (+277 B) | — | — · — · — |
| RadioListItem | 77.1 kB (+291 B) · 11.1 kB CSS (+295 B) | — | — · — · — |
| AppShell | 100.1 kB (+266 B) · 14.9 kB CSS (+317 B) | — | — · — · — |
| Typeahead | 89.9 kB (+291 B) · 13.8 kB CSS (+287 B) | — | — · — · — |
| ToggleButton | 94.3 kB (+296 B) · 11.3 kB CSS (+279 B) | — | — · — · — |
| BreadcrumbItem | 98.7 kB (+292 B) · 13.6 kB CSS (+278 B) | — | — · — · — |
| InfoTip | 51.3 kB (+292 B) · 5.7 kB CSS (+278 B) | — | — · — · — |
| RadioList | 61.7 kB (+291 B) · 7.6 kB CSS (+279 B) | — | — · — · — |
| TopNavMegaMenu | 78.2 kB (+263 B) · 13.0 kB CSS (+307 B) | — | — · — · — |
| DropdownMenuSubMenu | 79.6 kB (+277 B) · 10.8 kB CSS (+292 B) | — | — · — · — |
| SideNavCollapseButton | 67.8 kB (+285 B) · 11.2 kB CSS (+281 B) | — | — · — · — |
| DropdownMenu | 109.5 kB (+269 B) · 19.4 kB CSS (+296 B) | — | — · — · — |
| Selector | 115.6 kB (+292 B) · 19.2 kB CSS (+273 B) | — | — · — · — |
| CheckboxList | 74.0 kB (+290 B) · 8.1 kB CSS (+274 B) | — | — · — · — |
| SideNav | 123.3 kB (+283 B) · 12.5 kB CSS (+279 B) | — | — · — · — |
| Button | 66.9 kB (+278 B) · 11.1 kB CSS (+283 B) | — | — · — · — |
| TextArea | 93.3 kB (+288 B) · 9.7 kB CSS (+273 B) | — | — · — · — |
| ChatSendButton | 67.4 kB (+277 B) · 11.1 kB CSS (+283 B) | — | — · — · — |
| CheckboxInput | 70.3 kB (+272 B) · 10.6 kB CSS (+288 B) | — | — · — · — |
| IconButton | 67.0 kB (+277 B) · 11.1 kB CSS (+283 B) | — | — · — · — |
| Link | 57.4 kB (+281 B) · 7.4 kB CSS (+279 B) | — | — · — · — |
| TopNavMenu | 83.6 kB (+278 B) · 12.4 kB CSS (+282 B) | — | — · — · — |
| Table | 122.3 kB (+240 B) · 20.4 kB CSS (+319 B) | — | — · — · — |
| AlertDialog | 130.5 kB (+265 B) · 15.9 kB CSS (+293 B) | — | — · — · — |
| ChatDictationButton | 67.5 kB (+276 B) · 11.2 kB CSS (+281 B) | — | — · — · — |
| SideNavItem | 78.8 kB (+270 B) · 12.3 kB CSS (+285 B) | — | — · — · — |
| DialogHeader | 70.2 kB (+278 B) · 12.8 kB CSS (+276 B) | — | — · — · — |
| MoreMenu · Storybook | 109.8 kB (+258 B) · 19.4 kB CSS (+296 B) | 94 (0) | — · — · — |
| Pagination | 148.5 kB (+287 B) · 19.5 kB CSS (+267 B) | — | — · — · — |
| ChatLayout | 90.6 kB (+290 B) · 11.7 kB CSS (+262 B) | — | — · — · — |
| DateRangeInput | 101.5 kB (+282 B) · 13.7 kB CSS (+270 B) | — | — · — · — |
| MobileNavToggle | 67.2 kB (+269 B) · 11.1 kB CSS (+283 B) | — | — · — · — |
| Banner | 69.0 kB (+282 B) · 11.6 kB CSS (+269 B) | — | — · — · — |
| ChatLayoutScrollButton | 67.5 kB (+274 B) · 11.3 kB CSS (+277 B) | — | — · — · — |
| Slider | 115.6 kB (+275 B) · 9.2 kB CSS (+274 B) | — | — · — · — |
| Stepper | 68.7 kB (+272 B) · 11.3 kB CSS (+277 B) | — | — · — · — |
| Thumbnail | 71.4 kB (+264 B) · 12.7 kB CSS (+285 B) | — | — · — · — |
| Avatar | 46.5 kB (+279 B) · 6.0 kB CSS (+268 B) | — | — · — · — |
| Switch | 110.4 kB (+268 B) · 10.3 kB CSS (+279 B) | — | — · — · — |
| MultiSelector | 104.3 kB (+240 B) · 18.4 kB CSS (+305 B) | — | — · — · — |
| InputGroup | 61.9 kB (+270 B) · 8.2 kB CSS (+273 B) | — | — · — · — |
| TopNavHeading | 84.0 kB (+254 B) · 12.4 kB CSS (+287 B) | — | — · — · — |
| AvatarGroup | 49.3 kB (+279 B) · 6.1 kB CSS (+261 B) | — | — · — · — |
| Calendar | 78.1 kB (+270 B) · 11.8 kB CSS (+270 B) | — | — · — · — |
| SideNavHeading | 84.4 kB (+260 B) · 12.4 kB CSS (+280 B) | — | — · — · — |
| Field | 60.3 kB (+259 B) · 7.6 kB CSS (+278 B) | — | — · — · — |
| TableCell | 105.3 kB (+246 B) · 19.8 kB CSS (+291 B) | — | — · — · — |
| TableHeaderCell | 105.1 kB (+249 B) · 19.6 kB CSS (+288 B) | — | — · — · — |
| DrawerHeader | 70.4 kB (+279 B) · 14.3 kB CSS (+257 B) | — | — · — · — |
| FileInput | 75.9 kB (+265 B) · 12.1 kB CSS (+270 B) | — | — · — · — |
| HoverCard | 30.8 kB (+258 B) · 4.8 kB CSS (+277 B) | — | — · — · — |
| TabMenu | 80.7 kB (+260 B) · 12.3 kB CSS (+275 B) | — | — · — · — |
| ContextMenu | 104.1 kB (+243 B) · 19.3 kB CSS (+291 B) | — | — · — · — |
| CodeBlock | 82.4 kB (+262 B) · 12.5 kB CSS (+270 B) | — | — · — · — |
| TextInput | 99.6 kB (+259 B) · 12.3 kB CSS (+272 B) | — | — · — · — |
| FieldLabel | 56.2 kB (+252 B) · 6.1 kB CSS (+275 B) | — | — · — · — |
| Tokenizer | 106.6 kB (+233 B) · 20.8 kB CSS (+293 B) | — | — · — · — |
| Toast | 106.6 kB (+260 B) · 11.4 kB CSS (+265 B) | — | — · — · — |
| Carousel | 77.0 kB (+238 B) · 12.1 kB CSS (+283 B) | — | — · — · — |
| ChatComposer | 86.5 kB (+244 B) · 13.3 kB CSS (+275 B) | — | — · — · — |
| MobileNav | 78.5 kB (+253 B) · 11.7 kB CSS (+266 B) | — | — · — · — |
| ChatComposerTokenElement | 84.1 kB (+239 B) · 12.5 kB CSS (+278 B) | — | — · — · — |
| ChatComposerInput | 84.1 kB (+238 B) · 12.5 kB CSS (+278 B) | — | — · — · — |
| DateInput | 203.8 kB (+227 B) · 18.4 kB CSS (+288 B) | — | — · — · — |
| NumberInput | 104.7 kB (+237 B) · 12.6 kB CSS (+276 B) | — | — · — · — |
| SegmentedControl | 102.8 kB (+243 B) · 7.2 kB CSS (+270 B) | — | — · — · — |
| BaseTypeahead | 80.2 kB (+240 B) · 12.1 kB CSS (+272 B) | — | — · — · — |
| AvatarGroupOverflow | 52.5 kB (+244 B) · 6.0 kB CSS (+266 B) | — | — · — · — |
| TopNav | 80.2 kB (+248 B) · 12.1 kB CSS (+261 B) | — | — · — · — |
| Popover · Storybook | 100.9 kB (+246 B) · 15.5 kB CSS (+258 B) | 1,555 (+3) | — · — · — |
| Toolbar | 47.8 kB (+230 B) · 8.5 kB CSS (+274 B) | — | — · — · — |
| Lightbox | 150.5 kB (+229 B) · 12.3 kB CSS (+272 B) | — | — · — · — |
| TableSelectionToolbar | 77.3 kB (+256 B) · 14.4 kB CSS (+244 B) | — | — · — · — |
| ComplexSelector · Storybook | 79.4 kB (+235 B) · 13.0 kB CSS (+264 B) | 741 (0) | — · — · — |
| DateTimeInput | 227.3 kB (+214 B) · 20.1 kB CSS (+278 B) | — | — · — · — |
| TimeInput | 178.6 kB (+175 B) · 17.3 kB CSS (+309 B) | — | — · — · — |
| Markdown | 206.1 kB (+230 B) · 22.6 kB CSS (+247 B) | — | — · — · — |
| TabList | 48.1 kB (+197 B) · 6.8 kB CSS (+242 B) | — | — · — · — |
| lab/ChatEmojiPicker | 123.4 kB (+296 B) · 773 B CSS (0) | — | — · — · — |
| Timer | 15.3 kB (+1 B) · 6.4 kB CSS (+287 B) | — | — · — · — |
| lab/CommentComposer | 181.4 kB (+284 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/TransferList | 137.2 kB (+284 B) · 1.2 kB CSS (0) | — | — · — · — |
| ChatMessageList | 30.0 kB (0) · 7.4 kB CSS (+280 B) | — | — · — · — |
| Spinner | 26.6 kB (+1 B) · 6.6 kB CSS (+279 B) | — | — · — · — |
| Text | 13.2 kB (0) · 5.8 kB CSS (+280 B) | — | — · — · — |
| ChatToolCalls | 34.3 kB (0) · 8.8 kB CSS (+279 B) | — | — · — · — |
| Heading | 13.9 kB (−1 B) · 5.8 kB CSS (+280 B) | — | — · — · — |
| lab/TabBarMoreList | 103.1 kB (+279 B) · 1.8 kB CSS (0) | — | — · — · — |
| CommandPaletteInput | 33.8 kB (−1 B) · 7.9 kB CSS (+279 B) | — | — · — · — |
| Timestamp | 30.8 kB (0) · 11.4 kB CSS (+274 B) | — | — · — · — |
| lab/SelectableCardGroup | 69.8 kB (+272 B) · 162 B CSS (0) | — | — · — · — |
| ProgressBar | 12.0 kB (0) · 6.7 kB CSS (+271 B) | — | — · — · — |
| lab/ChatReactionBar | 124.5 kB (+270 B) · 1.1 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditor | 308.8 kB (+264 B) · 2.7 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 286.1 kB (+263 B) · 2.4 kB CSS (0) | — | — · — · — |
| charts/Chart | 243.1 kB (+262 B) · 516 B CSS (0) | — | — · — · — |
| lab/DialogHeroHeader | 91.4 kB (+262 B) · 372 B CSS (0) | — | — · — · — |
| lab/CommentThread | 373.6 kB (+261 B) · 2.4 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 310.2 kB (+259 B) · 454 B CSS (0) | — | — · — · — |
| charts/ChartTooltip | 219.8 kB (+258 B) · 451 B CSS (0) | — | — · — · — |
| lab/CommentPin | 61.2 kB (+251 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 146.1 kB (+251 B) · 1.4 kB CSS (0) | — | — · — · — |
| lab/DiffViewer | 95.1 kB (+250 B) · 2.1 kB CSS (0) | — | — · — · — |
| lab/TourStep | 95.8 kB (+247 B) · 691 B CSS (0) | — | — · — · — |
| lab/Comments | 380.6 kB (+246 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/Schedule | 116.8 kB (+243 B) · 3.9 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 119.4 kB (+239 B) · 751 B CSS (0) | — | — · — · — |
| lab/ListInput | 95.9 kB (+235 B) · 922 B CSS (0) | — | — · — · — |
| charts/ChartLegend | 48.7 kB (0) · 224 B CSS (0) | — | — · — · — |
| ContextMenuItem | 36.2 kB (0) · 7.1 kB CSS (0) | — | — · — · — |
| DropdownMenuCheckboxItem | 29.0 kB (0) · 7.5 kB CSS (0) | — | — · — · — |
| DropdownMenuDivider | 5.3 kB (0) · 548 B CSS (0) | — | — · — · — |
| DropdownMenuGroup | 6.4 kB (0) · 3.4 kB CSS (0) | — | — · — · — |
| DropdownMenuItem | 28.2 kB (0) · 6.9 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioGroup | 6.6 kB (0) · 3.3 kB CSS (0) | — | — · — · — |
| DropdownMenuRadioItem | 29.1 kB (0) · 7.5 kB CSS (0) | — | — · — · — |
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | — · — · — |
| SelectorOption | 24.4 kB (0) · 6.7 kB CSS (0) | — | — · — · — |
| TopNavItem | 14.6 kB (0) · 4.0 kB CSS (0) | — | — · — · — |
| TopNavMegaMenuFeaturedCard | 8.4 kB (0) · 3.6 kB CSS (0) | — | — · — · — |
| TopNavMegaMenuItem | 15.3 kB (0) · 4.2 kB CSS (0) | — | — · — · — |
| lab/LineClamp | 15.6 kB (0) · 168 B CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.71 MB packed (+2.1 kB); no new dependencies.
Wide change (8 components): add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
CI impact: 0 job-min per update · pool 0% · time to green −14.3 min · standard runners · 1 CI action or script file changed (not measured)
| Before | After | Change | |
|---|---|---|---|
| Job-minutes per PR update | 173.5 | 173.5 | 0 |
| Runner pool, runner-minutes a day | 51,781 | 51,781 | 0 (0%) |
| Average concurrent jobs | 36 | 36 | 0 |
| Time to green (median → this run) | 63 min | 48.6 min | −14.3 min |
| Runs a day | 298 | 298 | 0 |
Not measured (the jobs that use these keep their recent minutes above): .github/scripts/story-play-guard.js.
Assumptions: before is each job's average over the last 20 pull-request runs; after keeps that for unchanged jobs and uses this run's minutes for added or changed ones, weighted by how often each changed job ran in those runs; runs a day averages the seven whole days before today; time to green compares this run with the median of those runs that ran the same jobs.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
This pull request needs an engineering owner's spec decision before it can be approved, and it has three fixes to make either way.
The head rewrites spec:AST-059 FR4 (the "both flips" option goes; a last cover option for content taller than either side may cover its trigger), its platform floor and DEC-9, and architecture:layer-runtime's positioning text, and it adds the public constant layerViewportInset.lift: an engineering owner approves the record changes by commenting /approve-spec <full head SHA> on this pull request (the author may, as an engineering owner) and decides whether that constant should be public.
Fixes needed:
- A layer opened while its trigger is scrolled out of view no longer returns with it: in the "anchor already off-screen when the layer opens" story it settles at 693..1013 beside a trigger at 216..277 at 1280px (main returns it to 216..536), against AST-059 FR5, and the story does not assert the return.
- The description says "No public API change", but
layerViewportInset.liftis added to the public@astryxdesign/core/Layer/layerViewportInset.stylexentry, so either keep it private or state the addition. - The changeset says "every other
useLayersurface" stays on screen, but custom-positioned layers are unchanged, so it should say "every anchor-positioned layer".
The fix itself holds in Chromium: the new story's layer moves from 174..414 to 134..374 on a 390px screen (1064..1304 to 1024..1264 at 1280px), and the other captured layer stories and DropdownMenu's RTL story are unchanged.
Claims and files checked
Review mode: full; reason: no-earlier-review
Claims:
- Layers whose trigger runs past the viewport edge stay on screen (changeset): verified for anchor-positioned layers in the new story at 390px and 1280px; false for "every other
useLayersurface", since custom positioning is unchanged. - Layers place themselves with
anchor()insets instead of a position area (changeset): verified; the head layer computes no position area and inset values fromuseLayer.tsx:196-301. - Content taller than either side stays inside the viewport on long pages (changeset, description): the head keeps it at 16..828 with the page at scroll 0 and 32; the main failure was not reproduced in those states.
- A position area grows to include an off-screen anchor, so every option fits while the layer is off screen: verified on main (the new story's layer at 174..414 with a position area and zero insets).
- An aligned edge's inset is the larger of the gutter and the anchor edge: verified,
useLayer.tsx:215-258. - Flips mirror insets, margins and self alignment, and right-to-left still resolves through logical properties: verified, DropdownMenu's RTL story is identical at 390px and 1280px.
- The standard list is the two flips, the two slides and the cover, within Chromium's five options: verified,
getPositionTryFallbacksand the computed fallback list. - The opposite slide serves the case that needed both flips: verified in code (
layerSlideRules.ts:155-158), not exercised in a browser. - No public API change: false;
layerViewportInset.liftis added. - Custom and fixed positioning are untouched: verified in
renderContextand the unit suite. - The tooltip fit option stretches to its side's room with half the trigger's room as its minimum: verified,
layerSlideRules.ts:219-226. - The keyboard lift becomes a custom property every block inset reads: verified in the inset styles and options; the keyboard clearance suite passes.
- TopNav's mega menu caps its height with
stretch: verified,TopNavMegaMenu.tsx:174; not checked in a browser. - On main the new story's layer lands at 174..414 (390px) and 1064..1304 (1280px), and on the head at 134..374 and 1024..1264: verified.
- The new story runs in the story play guard at desktop and phone: verified,
story-play-guard.js:305-309. - A sweep found three changes, all fixes, and every other story pixel-identical in position: false; the "anchor already off-screen" story's layer no longer returns with its trigger.
- Popover's match-trigger layer at 390px moves from 32..390 to 16..374: verified.
- Unit suites pass, the Core typecheck and ESLint are clean, and the records are aligned: verified for the touched suites (2,526 tests), the typecheck, ESLint on the changed files and the knowledge check; the full 23,646-test run was not repeated.
- Main fails the new story at both viewports and every layer story passes on the branch: verified for the captured stories.
- On main a Selector list in a scrolled table header opened at 208..411 and a form selector list at 58..417 on a phone: not reproduced.
Files:
.changeset/layer-anchor-insets.md: finding (scope wording)..github/scripts/story-play-guard.js: clear.apps/storybook/stories/Layer.stories.tsx: clear for the new story; the unchanged tall-layer story's comment and check describe the old shift (non-blocking).docs/architecture/layer-runtime.md: awaits spec-owner approval.docs/specs/AST-059-layer-viewport-inset/spec.md: awaits spec-owner approval.packages/core/src/ComplexSelector/ComplexSelector.test.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear.packages/core/src/Layer/layerExitCopy.ts: clear.packages/core/src/Layer/layerSlideRules.ts: clear.packages/core/src/Layer/layerViewportInset.stylex.ts: finding (publiclift).packages/core/src/Layer/useLayer.doc.mjs: clear.packages/core/src/Layer/useLayer.test.tsx: clear.packages/core/src/Layer/useLayer.tsx: finding (return after an off-screen open); two comments to reflow (non-blocking).packages/core/src/Layer/useLayerKeyboardClearance.test.tsx: clear.packages/core/src/Layer/useLayerKeyboardClearance.ts: clear.packages/core/src/MoreMenu/MoreMenu.test.tsx: clear.packages/core/src/Popover/Popover.test.tsx: clear.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/TopNav/TopNavMegaMenu.tsx: clear.
There was a problem hiding this comment.
This pull request needs an engineering owner's spec decision before it can be approved, and two small fixes either way. The three earlier findings are fixed: a layer opened with its trigger scrolled away now comes back beside it (and on screen at 390px), layerViewportInset.lift is no longer public, and the changeset's scope matches the change.
The head rewrites spec:AST-059 FR4 (the "both flips" option goes; a last cover option for content taller than either side may cover its trigger), its platform floor and DEC-9, and architecture:layer-runtime's positioning text; an engineering owner approves those record changes by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
Fixes needed:
- Miss: Lint fails because
internal/eslint-plugin-astryx/no-comment-provenance.baseline.jsonstill lists 13 citations thatuseLayer.tsxno longer has; runnode internal/eslint-plugin-astryx/no-comment-provenance.baseline.mjswithout--checkand commit the result. - The description says "ESLint: no new warnings", but
useLayer.test.tsx:43importsLAYER_LIFT_PROPERTYwithout using it; drop the import.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Every anchor-positioned layer stays on screen when its trigger runs past the viewport edge (changeset): verified in the new story at 390px and 1280px.
- Layers place themselves with
anchor()insets against the viewport instead of a position area (changeset, description): verified; the head layer computes no position area and gutter-clamped insets. - Content taller than either side stays inside the viewport on long pages (changeset): the head keeps it at 16..828 on a 390px screen; the main failure was not reproduced.
- The fallback order is the preferred position, two flips, two slides and a cover option, within Chromium's five fallbacks: verified in the fallback list the runtime writes.
- A layer that keeps its trigger clear keeps its own list with the same insets: verified in the anchor-clear rules and their tests.
anchor()insets andanchor-centershipped with anchor positioning in each engine, and a browser without anchor positioning drops them: not checked; only Chromium was available.- Both
stretchsizes also declare-webkit-fill-available: verified in the TopNav cap and the fit option. - The new story's layer moves from 174..414 to 134..374 at 390px and from 1064..1304 to 1024..1264 at 1280px: verified.
- Taller than the viewport moves from 48..860 to 16..828: the head is 16..828; the main figure was not reproduced (main is also 16..828 here).
- Popover's match-trigger layer at 390px moves from 32..390 to 16..374: verified in the earlier review; that path is unchanged since.
- The comparison-table and form-wizard page measurements: not reproduced; those pages are the author's own.
- A position area grows to include an off-screen trigger, so every option fits while the layer leaves the screen: verified on main (174..414 with a position area).
- An aligned edge's inset is the larger of the gutter and the trigger's edge: verified in the inset styles.
- Flips mirror insets, margins and self alignment, and right-to-left resolves through logical properties: verified in code and in the direction-independence tests.
- The keyboard lift is a private custom property every block inset reads and is in no public entry point: verified; the built API surfaces are identical.
- Insets resolve against the scroll offsets of the last placement, a layer whose trigger came back into view is placed afresh once the scroll stops, and nothing reads layout during the scroll: verified; the re-pick lands 18 ms after the scroll ends and the scroll handlers read no layout.
- TopNav's mega menu caps its height with
stretch: verified in code; not checked in a browser. - No public API change; custom and fixed positioning are untouched: verified; the API generator finds no change, and only anchor positioning gets the new geometry or the re-pick.
- The new story runs in the story play guard at desktop and phone: verified.
- The off-screen-open story asserts the layer comes back beside its trigger: verified; it passes on the head at both widths and fails on main at 390px.
- The compiled-stylesheet test asserts the insets read the lift property: verified; it passes.
- Unit suites pass: verified for the touched suites (2,138 tests); the full run was not repeated.
- The Core typecheck is clean: verified.
- ESLint shows no new warnings: false; the test file imports a constant it never uses.
- The knowledge check reports the records aligned: verified.
- Main fails the new story at both viewports, and every Layer story passes on the branch: verified for the captured stories.
Files:
.changeset/layer-anchor-insets.md: clear (the earlier scope finding is fixed)..github/scripts/story-play-guard.js: clear.apps/storybook/stories/Layer.stories.tsx: clear for the new story and the new return check; the tall-layer story's comment still describes the old shift (non-blocking).docs/architecture/layer-runtime.md: awaits an engineering owner's spec approval.docs/specs/AST-059-layer-viewport-inset/spec.md: awaits an engineering owner's spec approval.packages/core/src/ComplexSelector/ComplexSelector.test.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear.packages/core/src/Layer/layerExitCopy.ts: clear.packages/core/src/Layer/layerSlideRules.ts: clear.packages/core/src/Layer/layerViewportInset.source-build.test.mjs: clear.packages/core/src/Layer/useLayer.doc.mjs: clear.packages/core/src/Layer/useLayer.test.tsx: finding (unused import).packages/core/src/Layer/useLayer.tsx: finding (its removed citations leave the provenance baseline stale); three comments to reflow (non-blocking).packages/core/src/Layer/useLayerKeyboardClearance.test.tsx: clear.packages/core/src/Layer/useLayerKeyboardClearance.ts: clear.packages/core/src/MoreMenu/MoreMenu.test.tsx: clear.packages/core/src/Popover/Popover.test.tsx: clear.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/TopNav/TopNavMegaMenu.tsx: clear.
There was a problem hiding this comment.
This pull request needs an engineering owner's spec decision before it can be approved, and three regressions need fixing either way. The two findings from the last review are fixed: the comment-provenance baseline is current and the unused test import is gone.
The head rewrites spec:AST-059 FR4 (the "both flips" option goes; a last cover option for content taller than either side may cover its trigger), its platform floor and DEC-9, and architecture:layer-runtime's positioning text; an engineering owner approves those record changes by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner.
Fixes needed:
- Miss:
packages/core/src/hooks/anchoredHint.tsx:37-38setsinset: 'auto'andmargin: 0on the hint layer, which now replaces the runtime'sanchor()insets, so the keyboard hints of TabList, SegmentedControl, Toolbar and List reorder mode open in the viewport's top-left corner over the control they describe (TabList: 0..127 × 8..37 instead of 16..143 × 56..85), andListReorderMode.interaction.browser.spec.ts:169and:542fail. - Miss: the software-keyboard cap (FR9) no longer holds, so a searchable Selector's or MultiSelector's list ends 69px under the keyboard and a popover taller than both sides of its trigger is never capped, failing
keyboardCappedLists.interaction.browser.spec.ts:173andPopoverKeyboard.interaction.browser.spec.ts:566. - Miss:
packages/lab/src/TransferList/TransferListSelector.test.tsx:707still expectsposition-area: self-block-end span-self-inline-endin the layer's style, sotest-uifails; assert the inset geometry as the Core suites now do.
All six interaction tests pass on the base and fail on this head.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Every anchor-positioned layer stays on screen when its trigger runs past the viewport edge (changeset): verified in the new story at 390px and 1280px.
- Layers place themselves with
anchor()insets against the viewport instead of a position area (changeset, description): verified in the styles the runtime applies. - Content taller than either side stays inside the viewport on long pages (changeset): the head keeps it at 16..828 on a 390px screen; the base failure was not reproduced (also 16..828 with the page scrolled).
- The fallback order is the preferred position, two flips, two slides and a cover option, within Chromium's five fallbacks: verified in the fallback list the runtime writes.
- A layer that keeps its trigger clear keeps its own list with the same insets: verified in the anchor-clear rules and their tests.
anchor()insets andanchor-centershipped with anchor positioning in each engine, and a browser without anchor positioning drops them: not checked; only Chromium was used for placement.- Both
stretchsizes also declare-webkit-fill-available: verified in the TopNav cap and the fit option. - The new story's layer moves from 174..414 to 134..374 at 390px and from 1064..1304 to 1024..1264 at 1280px: verified.
- Taller than the viewport moves from 48..860 to 16..828: the head is 16..828; the base figure was not reproduced.
- Popover's match-trigger layer at 390px moves from 32..390 to 16..374: verified in an earlier review; that path is unchanged since.
- The comparison-table and form-wizard page measurements: not reproduced; those pages are the author's own.
- A position area grows to include an off-screen trigger: verified on the base (174..414 with a position area).
- An aligned edge's inset is the larger of the gutter and the trigger's edge: verified in the inset styles.
- Flips mirror insets, margins and self alignment, and right-to-left resolves through logical properties: verified in code and in the direction-independence tests.
- The keyboard lift is a private custom property every block inset reads and is in no public entry point: verified; the API delta is empty.
- A layer whose trigger came back into view is placed afresh once the scroll stops, and nothing reads layout during the scroll: verified in code; the return lands on screen at 390px.
- TopNav's mega menu caps its height with
stretch: verified in code; not checked in a browser. - No public API change; custom and fixed positioning are untouched: verified.
- Representative unchanged paths (16 layer stories unchanged apart from three fixes): verified for the swept Layer stories; keyboard hints and keyboard-capped lists outside that sweep change.
- The new story runs in the story play guard at desktop and phone: verified.
- The off-screen-open story asserts the layer comes back beside its trigger: verified; it passes on the head and fails on the base at 390px.
- The compiled-stylesheet test asserts the insets read the lift property: verified.
- Unit suites pass: verified for the touched Core suites (2,138 tests); a Lab test fails in CI.
- The Core typecheck is clean: verified.
- ESLint shows no new warnings and the provenance baseline drops the removed citations: verified.
- The knowledge check reports the records aligned: verified in the earlier review; the records are unchanged since.
- Main fails the new story at both viewports, and every Layer story passes on the branch: verified for the captured stories.
Files:
.changeset/layer-anchor-insets.md: clear..github/scripts/story-play-guard.js: clear.apps/storybook/stories/Layer.stories.tsx: clear; the tall-layer story's comment still describes the old shift (non-blocking).docs/architecture/layer-runtime.md: awaits an engineering owner's spec approval.docs/specs/AST-059-layer-viewport-inset/spec.md: awaits an engineering owner's spec approval.internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear (up to date).packages/core/src/ComplexSelector/ComplexSelector.test.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear.packages/core/src/Layer/layerExitCopy.ts: clear.packages/core/src/Layer/layerSlideRules.ts: finding (the cover option and the keyboard cap).packages/core/src/Layer/layerViewportInset.source-build.test.mjs: clear.packages/core/src/Layer/useLayer.doc.mjs: clear.packages/core/src/Layer/useLayer.test.tsx: clear (the unused import is gone).packages/core/src/Layer/useLayer.tsx: finding (its insets are replaced by the anchored hint's styles, and the Lab test still expects the removedposition-area); three comments to reflow (non-blocking).packages/core/src/Layer/useLayerKeyboardClearance.test.tsx: clear.packages/core/src/Layer/useLayerKeyboardClearance.ts: finding (the keyboard cap).packages/core/src/MoreMenu/MoreMenu.test.tsx: clear.packages/core/src/Popover/Popover.test.tsx: clear.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/TopNav/TopNavMegaMenu.tsx: clear.
There was a problem hiding this comment.
This pull request needs an engineering owner's spec decision before it can be approved, and one description fix either way. The three regressions from the last review are fixed at this head: keyboard hints sit below their control again, the software-keyboard cap holds (the keyboardCappedLists, PopoverKeyboard and ListReorderMode specs pass), and the Lab TransferListSelector test passes.
The head rewrites spec:AST-059 FR4 (every option is bounded by the viewport also when the trigger runs past an edge, with the aligned edge clamped to the gutter), its platform support floor and DEC-9's mechanism list, and architecture:layer-runtime's positioning text. An engineering owner approves those record changes by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.
Fix needed:
- The description says "The fallback list is unchanged" and that the Tooltip and TopNav suites were updated, but centered layers lose their four span fallbacks (
useLayer.tsx:1199-1203, nine options to five) and no Tooltip or TopNav test changes, so please correct both statements.
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- The changeset: every anchor-positioned layer stays on screen when its trigger runs past the viewport edge, placed with
anchor()insets instead of a position area: verified in the new story at 390 px and 1280 px and in the runtime's styles. - A start- or end-aligned layer lines up with its trigger's edge and never comes closer than the 16 px gutter, even with the trigger past the edge: verified (134..374 at 390 px).
- On the placement axis the layer opens beside its trigger with the usual clearance: verified (4 px below the trigger).
- The fallback order is unchanged: verified for aligned layers (three flips, then the two slides); false for centered layers, which lose four span fallbacks.
- Content taller than either side keeps the preferred position and shifts into the screen: verified (16..828, unchanged from the base).
- A layer that keeps its trigger clear keeps its own list on the same insets: verified in the rules and their tests.
anchor()insets andanchor-centershipped with anchor positioning in each engine, and a browser without it drops them: not checked; only Chromium was available.- Both
stretchsizes also declare-webkit-fill-available: verified in the TopNav cap and the fit option. - The new story moves from 174..414 to 134..374 at 390 px and from 1064..1304 to 1024..1264 at 1280 px: verified.
- Popover match-trigger at 390 px moves from 32..390 to 16..374: verified.
- The comparison-table and form-wizard page figures and the 82-page sweep: not reproduced (the author's own pages).
- Other layer stories are unchanged: verified for "neither side fits", "taller than the viewport", the RTL flip and the TabList hint (pixel-identical).
- A position area grows to include an off-screen trigger: verified on the base.
- An aligned edge's inset is the larger of the gutter and the trigger's edge; flips mirror insets, margins and self alignment; right-to-left resolves through logical properties: verified in code, tests and the RTL story.
- The records are amended so record and code agree: verified in the diff; they await an engineering owner's approval.
- The keyboard lift is a private custom property every block inset reads and is in no public entry point: verified; the public API delta is empty.
- A layer whose trigger came back into view is placed afresh once the scroll stops, and nothing reads layout during the scroll: verified in code; it returns on screen (54..374 at 390 px, where the base leaves 216..536).
- TopNav's mega menu caps its height with
stretch: verified in code; not checked in a browser. - The keyboard hint no longer sets
inset: auto: verified; the hint sits below its tab and the List reorder-mode specs pass. - No public API change; custom and fixed positioning are untouched: verified.
- The new story is in the story play guard at desktop and phone: verified.
- The off-screen-open story asserts the return: verified; it passes on the head and fails on the base.
- The compiled-stylesheet test asserts the insets read the lift: verified; it passes.
- The Layer, Popover, DropdownMenu, MoreMenu, Selector, ComplexSelector, Tooltip, TopNav and Lab TransferList suites were updated: false for Tooltip and TopNav, whose tests do not change; the touched suites pass (3,094 tests).
- The Core typecheck is clean: verified (CI typecheck passed).
- ESLint shows no new warnings and the provenance baseline is current: verified (CI Lint passed); the knowledge check was not run separately.
- The interaction specs pass: verified (CI's full Chromium interaction suite and its WebKit leg passed; 52 rechecked here).
- Main fails the new story and the head passes it: verified at both viewports.
Files:
.changeset/layer-anchor-insets.md: clear..github/scripts/story-play-guard.js: clear.apps/storybook/stories/Layer.stories.tsx: clear.docs/architecture/layer-runtime.md: awaits an engineering owner's spec approval.docs/specs/AST-059-layer-viewport-inset/spec.md: awaits an engineering owner's spec approval.internal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clear.packages/core/src/ComplexSelector/ComplexSelector.test.tsx: clear.packages/core/src/DropdownMenu/DropdownMenu.test.tsx: clear.packages/core/src/Layer/layerExitCopy.ts: clear.packages/core/src/Layer/layerSlideRules.ts: clear.packages/core/src/Layer/layerViewportInset.source-build.test.mjs: clear.packages/core/src/Layer/useLayer.doc.mjs: clear.packages/core/src/Layer/useLayer.test.tsx: clear.packages/core/src/Layer/useLayer.tsx: the description misstates its fallback list; two non-blocking notes.packages/core/src/Layer/useLayerKeyboardClearance.test.tsx: clear.packages/core/src/Layer/useLayerKeyboardClearance.ts: clear.packages/core/src/MoreMenu/MoreMenu.test.tsx: clear.packages/core/src/Popover/Popover.test.tsx: clear.packages/core/src/Selector/Selector.test.tsx: clear.packages/core/src/TopNav/TopNavMegaMenu.tsx: clear.packages/core/src/hooks/anchoredHint.tsx: clear.packages/lab/src/TransferList/TransferListSelector.test.tsx: clear.
|
/approve-spec 8345ffd |
… screen when the trigger runs past the viewport
…k into view; keep the lift private
…ry; drop the cover option
…ce anchored layers no longer carry a position area [skip ci]
8345ffd to
3cc68e0
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision for this head, and one small fix is needed either way.
- Spec decision: the rewritten
spec:AST-059FR4 sentence, platform floor and DEC-9 list, andarchitecture:layer-runtime's positioning text, need an engineering owner to comment/approve-spec <full head SHA>on this head, because the earlier approval named the head before the rebase (the author may approve as an engineering owner). - Blocking: the description says "ESLint: no new warnings", but
packages/core/src/Selector/hooks.ts:155adds a@typescript-eslint/prefer-string-starts-ends-withwarning, so uselayerStyle.alignSelf.endsWith('self-end')or drop the claim.
The code otherwise checks out in Chromium: the new story fails on the base and passes here, and the Selector, Popover keyboard, Tooltip and Layer suites pass. CI has not run on this head, because its last commit skips CI.
Claims and files checked
Review mode: full; reason: rebase
Claims
- Changeset: every anchor-positioned layer stays on screen when its trigger runs past the viewport edge — verified (new story 134..374 against 174..414 on the base at 390 px; Tooltip 210..374 and DropdownMenu 277..374 with a trigger moved past the edge).
- Changeset: layers place themselves with
anchor()insets instead of a position area — verified (useLayer.tsx:198-302,layerSlideRules.ts:110-133; noposition-areain emitted styles). - Record change: both records name viewport-bounded
anchor()insets, and the aligned fallback order is unchanged — verified (useLayer.tsx:1199, record diff). - The new story fails on main at both viewports and passes here — verified (its play throws on the base at 390 and 1280 px).
- An aligned layer never comes closer than the 16 px gutter, even with its trigger past the edge — verified (story and the moved-trigger probes).
- Centered layers go from nine options to five, and Chromium tries no more than five — verified (
useLayer.tsx:1199-1203; FR4 states the limit). - Content taller than either side keeps its position and shifts into the screen — verified (
PopoverKeyboard.interaction.browser.spec.ts:566passes). - Tooltip keeps its own list on the same insets — verified (anchor-clear unit suite and Tooltip browser suites pass).
- Without anchor positioning the browser drops the insets and the layer gets no anchored geometry — partly: no anchored geometry either way, but by CSS's rules the end insets that stay valid put the layer in the viewport's end corner instead of its start corner; not run in such an engine.
- The browser support floor does not move (Chrome 125, Safari 26, Firefox 147) — consistent with the engines' release history; not tested in Safari or Firefox.
- Before and after positions for the new story and the Popover match-trigger story — verified (134..374, 1024..1264, 16..374); the app-page rows and the 82- and 98-page sweeps were not reproduced.
- The aligned inset is
max(gutter, anchor edge)with inline self alignment, and flips mirror insets, margins and alignment — verified (useLayer.tsx:218-262,getSelfAlignment). - The keyboard lift is a private property on no public entry point — verified (no API surface change).
- A layer whose anchor scrolled back is placed afresh once the scroll stops, with no layout read during the scroll — verified (
useLayer.tsx:2501-2533; scrolled-back story 54..374). - TopNav's mega menu caps with
stretch— verified (300 px viewport: 64..284, base 60..284). - The keyboard hint no longer sets
inset: auto— verified (anchoredHint.tsx:35-37; the List reorder hint spec passes). - The Selector reads a flip from the layer's computed block self alignment — verified (a flipped layer computes
align-self: self-end; 24 Selector browser specs pass). - No public API change — verified (the API surface comparison lists no row from this change).
- Regression tests: the new story and its play-guard entry, the scrolled-back assertion and the compiled-stylesheet test — verified (present and passing).
- The Tooltip and TopNav suites pass unchanged — verified.
tscis clean — verified (Core's build runs it).- ESLint: no new warnings — false (
Selector/hooks.ts:155). - The comment-provenance baseline is up to date — verified.
- 350 interaction specs, 24,964 unit tests, the records check and the failures said to match main — partly: the touched folders' 158 unit test files and 129 browser specs pass here; the full counts and the main comparisons were not re-run.
Files
.changeset/layer-anchor-insets.md— clear.github/scripts/story-play-guard.js— clearapps/storybook/stories/Layer.stories.tsx— cleardocs/architecture/layer-runtime.md— spec decision pendingdocs/specs/AST-059-layer-viewport-inset/spec.md— spec decision pendinginternal/eslint-plugin-astryx/no-comment-provenance.baseline.json— clearpackages/core/src/ComplexSelector/ComplexSelector.test.tsx— clearpackages/core/src/DropdownMenu/DropdownMenu.test.tsx— clearpackages/core/src/Layer/layerExitCopy.ts— clearpackages/core/src/Layer/layerSlideRules.ts— clearpackages/core/src/Layer/layerViewportInset.source-build.test.mjs— clearpackages/core/src/Layer/useLayer.doc.mjs— clearpackages/core/src/Layer/useLayer.test.tsx— clearpackages/core/src/Layer/useLayer.tsx— non-blocking: a Tooltip can re-place twice per scroll stop; two comments to reflowpackages/core/src/Layer/useLayerKeyboardClearance.test.tsx— clearpackages/core/src/Layer/useLayerKeyboardClearance.ts— clearpackages/core/src/MoreMenu/MoreMenu.test.tsx— clearpackages/core/src/Popover/Popover.test.tsx— clearpackages/core/src/Selector/Selector.test.tsx— clearpackages/core/src/Selector/hooks.ts— new lint warning at line 155packages/core/src/TopNav/TopNavMegaMenu.tsx— clearpackages/core/src/hooks/anchoredHint.tsx— clearpackages/lab/src/TransferList/TransferListSelector.test.tsx— clear
…; each anchored layer writes its own lift A trigger that stays in view while the page scrolls no longer leaves its layer at a stale gutter offset: the layer is placed afresh at each scroll stop while its anchor is in view. Every anchored layer writes its own keyboard lift, so a nested layer does not inherit its host's. The release note and docs say the layer stays on screen as long as it fits between the gutters. [skip ci]
… the list; records say every in-view anchored layer re-picks The layer runtime calls an internal onPlacedAfresh after it places a layer afresh at a scroll stop. The Selector then measures its overlay margin again, so a list that flipped keeps its selected row over the trigger. layer-runtime INV12 and its Positioning text now say an anchored layer whose anchor is in view re-picks once per scroll stop (AST-059 DEC-8).
|
/approve-spec 1e5071f |
There was a problem hiding this comment.
Approved pending CI: the remaining test-node shards have not finished on this head yet.
Anchored layers now stay inside the viewport gutters when their trigger runs past an edge: the new story fails on the base code (174..414 in a 390 px viewport) and passes here (134..374), and every finding from the earlier reviews is fixed. One non-blocking suggestion: nothing tests the Selector's re-measure after a scroll-stop re-pick, so a browser case that opens a list near the bottom edge, scrolls, and compares the list with a fresh open would guard it.
Claims and files checked
Review mode: full; reason: spec-record
- Claims:
- Changeset: every anchor-positioned layer stays on screen when its trigger runs partly past the viewport edge, as long as it fits between the gutters, by placing itself with
anchor()insets: verified (useLayer.tsx:188-302; the new story lands at 134..374 and 1024..1264). - The layer-runtime and layer-viewport-inset records now describe inset placement, the aligned-edge clamp, the platform floor and a re-pick of every in-view layer at a scroll stop, with the aligned-layer fallback order unchanged: verified (record diffs;
useLayer.tsx:1221-1225). - The new story fails on the base code at both widths and passes here: verified (174..414 and 1064..1304 on base code; 134..374 and 1024..1264 here).
- An aligned layer meets its trigger's edge but never comes closer than the 16 px gutter to a screen edge: verified (
useLayer.tsx:218-229). - The fallback list is six options; centered layers drop four span fallbacks, going from nine to five: verified (
useLayer.tsx:1221-1225; the base list had nine for centered layers). - Content taller than either side keeps its preferred position and shifts into the screen, and the keyboard cap builds on that: verified by the keyboard-cap browser specs passing in Chromium and WebKit CI at this head.
- Tooltip keeps its own list, with every option on the same insets: verified (
layerSlideRules.ts:179-210). - The browser floor does not move, the path without anchor positioning stays the reduced one, and the two
stretchsizes also declare-webkit-fill-available: verified in code (TopNavMegaMenu.tsx:174,layerSlideRules.ts:199-210); engine versions were not tested here. - Popover's match-trigger story at 390 px moves from 32..390 to 16..374: verified; the app-page numbers and the 13 unchanged stories were not re-measured.
- Every in-view anchored layer is placed afresh once per scroll stop, writing no coordinates, and a layer that keeps its anchor clear is placed once per stop: verified (
useLayer.tsx:2544-2564,:643-650,:951-961). - The scroll-stop cost figures: the author's trace, not re-measured.
- Selector re-measures its overlay after a re-pick, writing only its block-start margin, and the list lands where a fresh open puts it: verified (Chromium probe, 548..684 both ways;
hooks.ts:266-269). - Each anchored layer writes its own keyboard lift, so a nested layer does not inherit its host's: verified (
useLayer.tsx:2678-2684and its unit test). - Selector reads a block flip from the layer's computed self alignment: verified (
hooks.ts:155). - The keyboard hint no longer resets the runtime's insets, and TopNav's mega menu caps its height with
stretch: verified (anchoredHint.tsx:35,TopNavMegaMenu.tsx:174). - No public API change, the lift is private, and custom and fixed positioning are untouched: verified (built-surface comparison has no rows from this change;
useLayer.tsx:2629-2636). - Regression coverage: the off-screen story asserts the return, the compiled-stylesheet test asserts the lift, suites moved to the inset geometry, and the Tooltip and TopNav suites pass unchanged: verified (diff; 3,762 unit tests passed locally over the touched suites).
- Unit tests, typecheck, ESLint with no new warnings, aligned records and the interaction specs pass: verified for what ran here (touched unit suites, ESLint 0 warnings on every changed file, the knowledge check) and in CI at this head (typecheck, lint, interaction specs); the exact totals were not recounted.
- Changeset: every anchor-positioned layer stays on screen when its trigger runs partly past the viewport edge, as long as it fits between the gutters, by placing itself with
- Files:
.changeset/layer-anchor-insets.md: clear.github/scripts/story-play-guard.js: clearapps/storybook/stories/DropdownMenu.stories.tsx: clearapps/storybook/stories/Layer.stories.tsx: cleardocs/architecture/layer-runtime.md: clear (owner-approved at this head)docs/specs/AST-059-layer-viewport-inset/spec.md: clear (owner-approved at this head)docs/specs/components/Selector/Selector.spec.md: clearinternal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clearpackages/core/src/ComplexSelector/ComplexSelector.test.tsx: clearpackages/core/src/DropdownMenu/DropdownMenu.test.tsx: clearpackages/core/src/Layer/layerExitCopy.ts: clearpackages/core/src/Layer/layerSlideRules.ts: clearpackages/core/src/Layer/layerViewportInset.source-build.test.mjs: clearpackages/core/src/Layer/useLayer.doc.mjs: clearpackages/core/src/Layer/useLayer.test.tsx: clearpackages/core/src/Layer/useLayer.tsx: clearpackages/core/src/Layer/useLayerKeyboardClearance.test.tsx: clearpackages/core/src/Layer/useLayerKeyboardClearance.ts: clearpackages/core/src/MoreMenu/MoreMenu.test.tsx: clearpackages/core/src/Popover/Popover.test.tsx: clearpackages/core/src/Popover/usePopover.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: clear (non-blocking: no test for the re-measure)packages/core/src/Selector/hooks.ts: clear (non-blocking: no test for the re-measure)packages/core/src/TopNav/TopNavMegaMenu.tsx: clearpackages/core/src/hooks/anchoredHint.tsx: clearpackages/lab/src/TransferList/TransferListSelector.test.tsx: clear
…ide measures the overlay again The test fails when the runtime's onPlacedAfresh call or the Selector's re-measure is removed. [skip ci]
|
/approve-spec cb85bf0 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet.
Anchored layers now stay inside the viewport gutters when their trigger runs past an edge: the new story lands at 174..414 in a 390 px viewport on the base code and at 134..374 here. The new Selector test closes the last gap from the earlier review: it passes here and fails when either the runtime's re-pick callback or the Selector's re-measure is removed.
Claims and files checked
Review mode: incremental; reason: none
- Changed rules (0): none.
- Claims:
- Changeset: every anchor-positioned layer stays on screen when its trigger runs partly past the viewport edge, as long as it fits between the gutters, by placing itself with
anchor()insets: verified (useLayer.tsx:188-302; the new story lands at 134..374 and 1024..1264). - The layer-runtime and layer-viewport-inset records now describe inset placement bounded by the viewport, a re-pick of every in-view anchored layer at each scroll stop and the new platform floor, with the aligned-layer fallback order unchanged: verified (record diffs;
useLayer.tsx:1221-1225). - The new story fails on the base code at both widths and passes here: verified (174..414 and 1064..1304 on the base code; 134..374 and 1024..1264 here).
- An aligned layer meets its trigger's edge but never comes closer than the 16 px gutter to a screen edge: verified (
useLayer.tsx:218-229). - The fallback list is six options, and centered layers drop four span fallbacks, going from nine to five: verified (
useLayer.tsx:1221-1225). - Content taller than either side keeps its preferred position and shifts into the screen, and the keyboard cap builds on that: verified by the keyboard-cap browser specs passing in Chromium and WebKit on the previous head, whose shipped code is identical.
- Tooltip keeps its own list, with every option on the same insets: verified (
layerSlideRules.ts:179-221). - The browser floor does not move, the path without anchor positioning stays the reduced one, and the two
stretchsizes also declare-webkit-fill-available: verified in code (TopNavMegaMenu.tsx:174,layerSlideRules.ts:205); engine versions were not tested. - The before/after sweep: the new story's rows verified here; Popover's match-trigger fix was measured on identical rendered code earlier; the app-page rows and the 13 unchanged stories were not re-measured.
- Every in-view anchored layer is placed afresh once per scroll stop and writes no coordinates, and a layer that keeps its anchor clear is placed once per stop: verified (
useLayer.tsx:2544-2564,:643-650,:949-961). - The new "anchor stays in view while the page scrolls" story fails on an earlier head and passes here: its pass was seen on identical rendered code; the earlier-head failure was not re-run.
- The scroll-stop cost figures: the author's trace, not re-measured.
- Selector measures its overlay again after a re-pick, writing only its block-start margin, so the list lands where a fresh open puts it: verified (Chromium: 548..684 after the scroll stop and on a fresh open;
hooks.ts:266-269). - The new Selector test fails when the runtime's callback is removed and when the re-measure is a no-op, and the Selector, ComplexSelector and MultiSelector suites pass 752 of 752: verified (both changes fail it at
Selector.test.tsx:754; 752 tests pass). - Each anchored layer writes its own keyboard lift, so a nested layer does not inherit its host's: verified (
useLayer.tsx:2678-2684and its unit test). - Selector reads a block flip from the layer's computed self alignment: verified (
hooks.ts:155). - The keyboard hint no longer resets the runtime's insets, and TopNav's mega menu caps its height with
stretch: verified (anchoredHint.tsx:35,TopNavMegaMenu.tsx:174). - No public API change, the lift is private, and custom and fixed positioning are untouched: verified (the built surface has no rows from this change).
- Regression coverage (the off-screen story asserts the return, the compiled-stylesheet test asserts the lift, suites moved to the inset geometry, Tooltip and TopNav suites pass unchanged): verified (2,491 tests over the touched suites pass here).
- Typecheck clean, no new ESLint warnings, aligned records: verified for typecheck and ESLint on the changed source and test files; the records are unchanged since they were checked aligned.
- The full unit-test total, the interaction-spec total and the page sweeps: not recounted; the interaction specs passed in CI on the previous head.
- Changeset: every anchor-positioned layer stays on screen when its trigger runs partly past the viewport edge, as long as it fits between the gutters, by placing itself with
- Files:
.changeset/layer-anchor-insets.md: clear.github/scripts/story-play-guard.js: clearapps/storybook/stories/DropdownMenu.stories.tsx: clearapps/storybook/stories/Layer.stories.tsx: cleardocs/architecture/layer-runtime.md: clear (owner-approved at this head)docs/specs/AST-059-layer-viewport-inset/spec.md: clear (owner-approved at this head)docs/specs/components/Selector/Selector.spec.md: clearinternal/eslint-plugin-astryx/no-comment-provenance.baseline.json: clearpackages/core/src/ComplexSelector/ComplexSelector.test.tsx: clearpackages/core/src/DropdownMenu/DropdownMenu.test.tsx: clearpackages/core/src/Layer/layerExitCopy.ts: clearpackages/core/src/Layer/layerSlideRules.ts: clearpackages/core/src/Layer/layerViewportInset.source-build.test.mjs: clearpackages/core/src/Layer/useLayer.doc.mjs: clearpackages/core/src/Layer/useLayer.test.tsx: clearpackages/core/src/Layer/useLayer.tsx: clearpackages/core/src/Layer/useLayerKeyboardClearance.test.tsx: clearpackages/core/src/Layer/useLayerKeyboardClearance.ts: clearpackages/core/src/MoreMenu/MoreMenu.test.tsx: clearpackages/core/src/Popover/Popover.test.tsx: clearpackages/core/src/Popover/usePopover.tsx: clearpackages/core/src/Selector/Selector.test.tsx: clearpackages/core/src/Selector/Selector.tsx: clearpackages/core/src/Selector/hooks.ts: clearpackages/core/src/TopNav/TopNavMegaMenu.tsx: clearpackages/core/src/hooks/anchoredHint.tsx: clearpackages/lab/src/TransferList/TransferListSelector.test.tsx: clear
- #12895 experimental theme: a saved --only on a part styled on its own opens Author: @josephfarina - #12706 fix(cli): template reads ~/ as the home folder, never a folder named ~ Author: @josephfarina - #12750 feat(cli): experimental icon names each match's meaning import Author: @josephfarina - #12307 fix(core): keep anchored layers on screen when their trigger runs past the viewport Author: @josephfarina
|
Landed in #12940. |
fix(core): keep anchored layers on screen when their trigger runs past the viewport
Record change (one line):
architecture:layer-runtimeandspec:AST-059now say anchored layers are placed with logicalanchor()insets bounded by the viewport while their anchor is in view, not a position area, andlayer-runtimeINV12 says every in-view anchored layer re-picks once per scroll stop (DEC-8); the platform floor namesanchor()insets andanchor-center; the fallback order for aligned layers is unchanged.Proof at a glance: before/after positions are in the sweep table below (the new story fails on main at both viewports and passes here). Gate results on the current head: story play guard (real Chromium, desktop and phone) passes for every Layer story this change touches; 350 interaction specs and 24,964 unit tests pass; a phone/dark sweep over 82 pages gained one passing page and lost none; a parity sweep over 98 pages was unchanged.
For reviewers
What changes, in plain words. An anchored layer is placed against the screen, not against an area that stretches to wherever its trigger is. On the side axis, a start- or end-aligned layer lines up with its trigger's edge. It never comes closer than the 16 px gutter to a screen edge, even when the trigger itself runs past that edge. On the placement axis it opens beside its trigger with the usual clearance.
Fallback order, in plain words. The browser tries these in turn and keeps the first that fits inside the screen and its gutters:
For start- and end-aligned layers this is the same list as today. Centered layers drop their four one-sided span fallbacks (
top span-leftand so on), going from nine options to the same five. Those spans areposition-areakeywords and have no meaning once the layer is placed with insets. A centered layer now spans the viewport between both gutters withanchor-center, so its own position already slides it the least distance that keeps it on screen. Chromium also tries no more than five options, so in practice the old ninth-to-sixth entries were never reached.Content taller than either side of the trigger fits no option. The browser keeps the preferred position and shifts it into the screen, as today; the software keyboard's cap and lift build on that. A layer that keeps its trigger clear (Tooltip) keeps its own list, and every option there now uses the same insets.
Browser support. The previous model needed
position-area. This one needsanchor()insets andanchor-center. Both shipped together with anchor positioning in each engine, so the supported floor does not move.anchor()insets,anchor-center,@position-tryposition-area(previous model)position-try-fallbacksname 128+)Without anchor positioning, the
anchor()insets and the fallback list are invalid, and the browser drops them. That is the same reduced path the previous model took: the popover still opens and dismisses, but it gets no anchored geometry. The twostretchsizes (TopNav's mega menu height, Tooltip's fit option) also declare-webkit-fill-available. Where neither keyword is supported, the runtime's viewport cap still bounds the layer.Before/after sweep (built Storybook, real Chromium, layer opened, position of its box):
Alternatives considered.
anchor()inside a position area. These resolve against the grown area too, so no gutter, max size or fallback written there can bound the layer by the screen.Scroll-stop re-pick and INV21
Every anchored layer whose anchor is in view when a scroll stops is placed afresh once, in the first painted frame after the stop (
spec:AST-059FR4, DEC-8), not only one whose anchor came back into view. The new story "anchor stays in view while the page scrolls" (in the play guard, desktop and phone) fails on the previous head, where the layer keeps the old gutter hold 10 px from its trigger, and passes here. Placing afresh toggles the layer'sdisplayso the browser chooses among the layer's own CSS options again; it writes notop,left,inset,translateortransform, so CSS anchor positioning still does all placement (architecture:layer-runtimeINV21;spec:AST-059DEC-9: "the re-pick that DEC-7 keeps choose[s] among the layer's CSS options ... and write[s] no coordinates"). Nothing reads or forces layout during the scroll itself. A layer that keeps its anchor clear (Tooltip) is placed afresh by its own scroll-stop listener (observeAnchorClearance) when its anchor is in view, and checked against its anchor otherwise, so it is placed once per stop.Scroll-stop cost and the Selector overlay
Measured in Chromium on a built Storybook, previous head against this head, a 10-step wheel page scroll with the trigger in view (median of 5):
The forced layouts run only at scroll stops, never in a scroll frame, at about 0.7 to 1.2 ms per open layer per stop: one for the re-pick and two to keep the layer's running animations through it.
A Selector list now measures its overlay again after a scroll stop re-picks it (an internal
onPlacedAfreshfrom the layer runtime), so the margin always matches the side the browser picked. The re-measure writes only the list's block-start overlay margin, the same value and the same path a fresh open uses; it writes notop,left,inset,translateortransform, and CSS anchor positioning still places the layer (architecture:layer-runtimeINV21). The margin is whatcomponent:SelectorFR2 owns: "a non-search popover aligns the selected row over the trigger and clamps it to the viewport". In a 700 px window with the trigger scrolled near the bottom (y 640, 670 and 630), the list was off the bottom edge in 3 of 3 cases on main's behavior and in 2 of 3 after a re-pick without the re-measure (its selected row 30 px off the trigger). With the re-measure the list is on screen in 3 of 3 and its selected row sits exactly where a list opened fresh at that trigger position puts it (the same viewport clamp, row 40/80/50 px above the trigger center in both cases).Keyboard lift on nested layers
Every anchored layer now writes its own
--_astryx-layer-lift(0pxunless the software keyboard lifts it), so a layer opened inside a lifted layer does not inherit the host's lift (INV11,spec:AST-059FR9).User impact
A menu, selector list, popover, or tooltip whose trigger runs past the viewport edge opens off screen. This happens to a control in a panel that scrolls sideways, such as a Selector in a table column header on a phone, or a field wider than its column. On a 390 px phone, a Selector list in a scrolled table header opened at x 208..411, and a form selector list at x 58..417.
Problem and solution fit
Insets that call
anchor()resolve against the viewport itself. The layer runtime now places every anchor-mode layer with logicalanchor(inside)/anchor(outside)insets and inline self alignment. An aligned edge's inset ismax(gutter, anchor edge), so the layer never comes closer to a viewport edge than the gutter. Flip tactics mirror insets, margins, and self alignment as before, and RTL still resolves through logical properties.Expected behavior and authority
architecture:layer-runtimeandspec:AST-059already require every anchor-mode layer to keep a gutter from each viewport edge and never leave the viewport (FR1, FR2, FR4). This PR amends both records in the same change so record and code agree:layer-runtimeINV12, its Positioning paragraph and its verification row say that at a scroll stop an anchored layer whose anchor is in view is re-picked (placed afresh) once, and a layer that keeps its anchor clear is otherwise checked, asspec:AST-059DEC-8 already requires ("An anchored layer re-picks its position once, in the first painted frame after scrolling stops").The positioning section names logical
anchor()insets in place of a position area.The viewport-inset section states the aligned-edge clamp.
FR4 states that options are bounded by the viewport even when the anchor runs past an edge.
component:Selector: the FR2 verification row's failure expectation names the layer's self alignment in place ofposition-area(an anchored layer no longer carries a position area; the Selector reads a block flip fromalign-self).Smallest restoration
One geometry path for every anchor-mode layer, with no per-component special cases:
useLayer: placement-axis and alignment-axis inset styles and inline self alignment. The fallback list is unchanged for aligned layers; centered layers drop the fourposition-areaspan fallbacks (see above).layerSlideRules: slide, beside, and fit options written with insets. The Tooltip fit option stretches to its side's room, with half the trigger's room as its minimum.anchor()insets resolve against the scroll offsets the browser recorded when it last placed the layer, and a scroll only translates the result. The aligned inset holds the gutter only while the anchor is in view, so a layer whose anchor scrolled back into view is placed afresh once the scroll stops. This uses the runtime's existing one-shot placement. Nothing reads or forces layout during the scroll itself.stretch(the room below the nav), because100%no longer means that room.inset: autoon its layer, which would replace the runtime's insets.self-starttoself-end), because the layer no longer has a position area to read.No public API change. Custom and fixed positioning are untouched.
Evidence
Core/Layerstory "anchor runs past the viewport edge" puts a trigger 40 px past the inline-end edge. On main the layer lands at 174..414 on a 390 px phone and 1064..1304 at 1280 px.useLayer.test.tsxasserts the inset geometry, self alignment, hold and slide rules. The Layer, Popover, DropdownMenu, MoreMenu, Selector, ComplexSelector and lab TransferList suites were updated from position-area strings to the inset geometry; the Selector's flipped-list gutter case now models the flip as the mirrored self alignment. The Tooltip and TopNav suites pass unchanged.Scope
Components: Layer runtime (useLayer, layerSlideRules, useLayerKeyboardClearance, layerExitCopy), Popover (forwards
onPlacedAfresh), Selector (reads a block flip from self alignment and measures its overlay again after a re-pick), the anchored keyboard hint (hooks/anchoredHint), TopNavMegaMenu, Layer storiesWriting rubric results
R1 narration: none. New record sentences describe the system in the present tense; the reason a position area is not used is stated as a constraint.
R2 research: none in the records; the before/after sweep is evidence in this description.
R3 evidence: no evidence cell names a pull request.
R4 rejected alternatives: one, a position area, named in the
layer-runtimePositioning sentence on why it is not used (it grows to include an anchor that runs past the viewport).R5 change references: none.
R6 open questions: none.
R7 project status: none.
Note,
component:SelectorFR2 verification row: one wording change in an existing cell (self alignment in place ofposition-area); R1–R7 hold for it as above.Testing
Selector.test.tsx"measures the overlay again when a scroll stop re-picks the list onto the other side": opens a non-search Selector, flips the layer at a scroll stop (align-self: self-end,scrollendon the document), and asserts the overlay margin switches to the flipped value. It fails when the runtime'sonPlacedAfreshcall is removed and when the Selector's re-measure is made a no-op; Selector, ComplexSelector and MultiSelector suites pass 752/752.vitest --project ui packages/core packages/lab: 24,964 tests pass.tsc -p packages/core --noEmit: clean. ESLint: no new warnings; the comment-provenance baseline is up to date.check-knowledge: records aligned.ListReorderMode(keyboard hint placement) andkeyboardCappedLists/PopoverKeyboard(software-keyboard cap). One DropdownMenu opening-release spec fails the same way against a Storybook built from main in this environment.preflight: pass cb85bf0 (env-only fails excused: internal/vibe-tests/setup-test/setup-workspace.test.mjs, which fails the same way at the merge base; review clears with the exact-head /approve-spec)