Repository navigation
fix(Layer): keep an entrance's first frame off its trigger - #11396
Conversation
An anchored layer's entrance starts one spacing step toward its trigger. A tall tooltip sits 4 px beside its trigger, so its 8 px step started it over the trigger, against layer-runtime INV20. The runtime now writes the room between a layer and its trigger, and the shared entrance keyframes cap the step at it. A layer against its trigger, as a menu at the pointer, writes no room and keeps the whole step.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec c00608e |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| MultiSelector | 100.0 kB (+137 B) · 17.2 kB CSS (+21 B) | — | — · — · — |
| SideNav | 119.1 kB (+135 B) · 11.7 kB CSS (+21 B) | — | — · — · — |
| SideNavItem | 75.5 kB (+134 B) · 11.5 kB CSS (+22 B) | — | — · — · — |
114 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Slider | 113.4 kB (+135 B) · 8.9 kB CSS (+20 B) | — | — · — · — |
| DropdownMenuSubMenu | 73.6 kB (+131 B) · 10.1 kB CSS (+21 B) | — | — · — · — |
| InfoTip | 49.7 kB (+131 B) · 5.4 kB CSS (+21 B) | — | — · — · — |
| NumberInput | 75.4 kB (+132 B) · 11.8 kB CSS (+20 B) | — | — · — · — |
| SideNavHeading | 81.0 kB (+129 B) · 11.7 kB CSS (+23 B) | — | — · — · — |
| TableSelectionToolbar | 74.1 kB (+133 B) · 13.6 kB CSS (+19 B) | — | — · — · — |
| ChatLayout | 87.0 kB (+131 B) · 10.9 kB CSS (+20 B) | — | — · — · — |
| FieldLabel | 54.6 kB (+134 B) · 5.8 kB CSS (+17 B) | — | — · — · — |
| TopNavHeading | 80.6 kB (+128 B) · 11.6 kB CSS (+23 B) | — | — · — · — |
| Typeahead | 86.2 kB (+129 B) · 12.8 kB CSS (+22 B) | — | — · — · — |
| DrawerHeader | 66.9 kB (+127 B) · 13.3 kB CSS (+23 B) | — | — · — · — |
| TableHeaderCell | 114.3 kB (+124 B) · 18.0 kB CSS (+24 B) | — | — · — · — |
| ToggleButton | 90.8 kB (+128 B) · 10.4 kB CSS (+20 B) | — | — · — · — |
| TopNavMenu | 80.0 kB (+126 B) · 11.6 kB CSS (+22 B) | — | — · — · — |
| MoreMenu | 102.9 kB (+125 B) · 17.9 kB CSS (+22 B) | — | — · — · — |
| BreadcrumbItem | 90.2 kB (+119 B) · 12.5 kB CSS (+26 B) | — | — · — · — |
| ChatSendButton | 64.2 kB (+125 B) · 10.3 kB CSS (+20 B) | — | — · — · — |
| AppShell | 95.6 kB (+124 B) · 13.8 kB CSS (+20 B) | — | — · — · — |
| Popover | 96.0 kB (+125 B) · 14.6 kB CSS (+19 B) | — | — · — · — |
| CodeBlock | 79.1 kB (+119 B) · 11.6 kB CSS (+23 B) | — | — · — · — |
| DropdownMenu | 102.7 kB (+120 B) · 17.9 kB CSS (+22 B) | — | — · — · — |
| ListItem | 74.0 kB (+123 B) · 11.7 kB CSS (+19 B) | — | — · — · — |
| MobileNavToggle | 64.1 kB (+122 B) · 10.3 kB CSS (+20 B) | — | — · — · — |
| SideNavCollapseButton | 64.7 kB (+121 B) · 10.4 kB CSS (+21 B) | — | — · — · — |
| TableCell | 114.8 kB (+119 B) · 18.3 kB CSS (+23 B) | — | — · — · — |
| Toast | 102.0 kB (+124 B) · 10.6 kB CSS (+18 B) | — | — · — · — |
| Avatar | 45.3 kB (+114 B) · 5.7 kB CSS (+27 B) | — | — · — · — |
| Pagination | 115.8 kB (+120 B) · 18.2 kB CSS (+21 B) | — | — · — · — |
| PowerSearch | 301.1 kB (+128 B) · 24.7 kB CSS (+13 B) | — | — · — · — |
| Selector | 105.6 kB (+120 B) · 17.9 kB CSS (+21 B) | — | — · — · — |
| TextArea | 66.0 kB (+120 B) · 9.4 kB CSS (+21 B) | — | — · — · — |
| Stepper | 65.6 kB (+121 B) · 10.5 kB CSS (+19 B) | — | — · — · — |
| Banner | 65.8 kB (+118 B) · 10.9 kB CSS (+21 B) | — | — · — · — |
| AvatarGroup | 48.1 kB (+114 B) · 5.8 kB CSS (+24 B) | — | — · — · — |
| Carousel | 73.4 kB (+116 B) · 11.3 kB CSS (+22 B) | — | — · — · — |
| DateTimeInput | 217.1 kB (+117 B) · 19.1 kB CSS (+21 B) | — | — · — · — |
| DialogHeader | 66.7 kB (+116 B) · 11.9 kB CSS (+22 B) | — | — · — · — |
| FileInput | 72.8 kB (+118 B) · 11.3 kB CSS (+20 B) | — | — · — · — |
| IconButton | 63.9 kB (+118 B) · 10.3 kB CSS (+20 B) | — | — · — · — |
| Tooltip | 31.4 kB (+118 B) · 4.5 kB CSS (+20 B) | — | — · — · — |
| Button | 63.8 kB (+117 B) · 10.3 kB CSS (+20 B) | — | — · — · — |
| ComplexSelector | 76.2 kB (+116 B) · 12.2 kB CSS (+21 B) | — | — · — · — |
| ContextMenu | 113.5 kB (+115 B) · 17.8 kB CSS (+22 B) | — | — · — · — |
| DateRangeInput | 97.9 kB (+115 B) · 12.9 kB CSS (+22 B) | — | — · — · — |
| TabMenu | 77.3 kB (+116 B) · 11.5 kB CSS (+21 B) | — | — · — · — |
| AlertDialog | 109.9 kB (+122 B) · 15.0 kB CSS (+14 B) | — | — · — · — |
| AvatarGroupOverflow | 51.2 kB (+109 B) · 5.7 kB CSS (+27 B) | — | — · — · — |
| ChatComposerInput | 80.9 kB (+114 B) · 11.7 kB CSS (+22 B) | — | — · — · — |
| ChatComposerTokenElement | 80.9 kB (+114 B) · 11.7 kB CSS (+22 B) | — | — · — · — |
| Calendar | 74.9 kB (+115 B) · 11.0 kB CSS (+20 B) | — | — · — · — |
| Drawer | 52.8 kB (+114 B) · 8.4 kB CSS (+21 B) | — | — · — · — |
| StatusDot | 33.2 kB (+114 B) · 5.4 kB CSS (+21 B) | — | — · — · — |
| ChatComposer | 83.2 kB (+111 B) · 12.4 kB CSS (+23 B) | — | — · — · — |
| CheckboxListItem | 74.9 kB (+115 B) · 11.7 kB CSS (+19 B) | — | — · — · — |
| Link | 55.6 kB (+108 B) · 7.1 kB CSS (+26 B) | — | — · — · — |
| SegmentedControl | 101.2 kB (+109 B) · 6.9 kB CSS (+25 B) | — | — · — · — |
| TimeInput | 168.6 kB (+110 B) · 16.4 kB CSS (+24 B) | — | — · — · — |
| Lightbox | 127.7 kB (+112 B) · 10.9 kB CSS (+21 B) | — | — · — · — |
| RadioListItem | 71.2 kB (+115 B) · 10.4 kB CSS (+18 B) | — | — · — · — |
| TopNav | 76.1 kB (+110 B) · 11.3 kB CSS (+23 B) | — | — · — · — |
| Switch | 107.9 kB (+110 B) · 10.0 kB CSS (+22 B) | — | — · — · — |
| Markdown | 193.7 kB (+109 B) · 21.1 kB CSS (+22 B) | — | — · — · — |
| TopNavMegaMenu | 74.8 kB (+113 B) · 12.2 kB CSS (+18 B) | — | — · — · — |
| ChatDictationButton | 64.4 kB (+109 B) · 10.4 kB CSS (+21 B) | — | — · — · — |
| lab/CommentThread | 353.8 kB (+130 B) · 2.4 kB CSS (0) | — | — · — · — |
| CheckboxList | 72.3 kB (+108 B) · 7.8 kB CSS (+21 B) | — | — · — · — |
| Thumbnail | 68.2 kB (+110 B) · 11.9 kB CSS (+19 B) | — | — · — · — |
| Field | 58.5 kB (+105 B) · 7.3 kB CSS (+23 B) | — | — · — · — |
| MobileNav | 74.4 kB (+109 B) · 11.0 kB CSS (+19 B) | — | — · — · — |
| DateInput | 194.5 kB (+106 B) · 17.4 kB CSS (+21 B) | — | — · — · — |
| HoverCard | 29.7 kB (+111 B) · 4.5 kB CSS (+16 B) | — | — · — · — |
| ChatLayoutScrollButton | 64.4 kB (+106 B) · 10.5 kB CSS (+20 B) | — | — · — · — |
| Table | 130.7 kB (+103 B) · 18.7 kB CSS (+23 B) | — | — · — · — |
| lab/DialogHeroHeader | 87.0 kB (+126 B) · 372 B CSS (0) | — | — · — · — |
| BaseTypeahead | 77.0 kB (+101 B) · 11.3 kB CSS (+22 B) | — | — · — · — |
| CheckboxInput | 68.0 kB (+103 B) · 10.1 kB CSS (+20 B) | — | — · — · — |
| lab/ListInput | 91.9 kB (+123 B) · 922 B CSS (0) | — | — · — · — |
| lab/TransferList | 106.1 kB (+123 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/Schedule | 110.6 kB (+122 B) · 3.9 kB CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 67.9 kB (+121 B) · 162 B CSS (0) | — | — · — · — |
| lab/TourStep | 102.3 kB (+120 B) · 590 B CSS (0) | — | — · — · — |
| Tokenizer | 102.3 kB (+102 B) · 19.5 kB CSS (+17 B) | — | — · — · — |
| richtext/RichTextEditor | 302.2 kB (+118 B) · 2.6 kB CSS (0) | — | — · — · — |
| RadioList | 59.9 kB (+95 B) · 7.3 kB CSS (+22 B) | — | — · — · — |
| InputGroup | 60.2 kB (+94 B) · 7.9 kB CSS (+22 B) | — | — · — · — |
| richtext/RichTextView | 280.4 kB (+115 B) · 2.3 kB CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 112.5 kB (+114 B) · 1.1 kB CSS (0) | — | — · — · — |
| charts/Chart | 210.2 kB (+113 B) · 516 B CSS (0) | — | — · — · — |
| lab/CommentComposer | 157.1 kB (+113 B) · 1.9 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 285.0 kB (+113 B) · 454 B CSS (0) | — | — · — · — |
| TextInput | 71.5 kB (+91 B) · 11.5 kB CSS (+21 B) | — | — · — · — |
| lab/ChatEmojiPicker | 111.3 kB (+112 B) · 773 B CSS (0) | — | — · — · — |
| lab/Comments | 360.5 kB (+111 B) · 2.5 kB CSS (0) | — | — · — · — |
| lab/CommentPin | 59.6 kB (+109 B) · 1.2 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 90.8 kB (+107 B) · 751 B CSS (0) | — | — · — · — |
| lab/TabBarMoreList | 96.4 kB (+107 B) · 1.8 kB CSS (0) | — | — · — · — |
| lab/TransferListSelector | 114.9 kB (+103 B) · 1.4 kB CSS (0) | — | — · — · — |
| charts/ChartTooltip | 187.3 kB (+100 B) · 451 B CSS (0) | — | — · — · — |
| lab/DiffViewer | 91.4 kB (+95 B) · 2.1 kB CSS (0) | — | — · — · — |
| CommandPalette | 75.4 kB (+79 B) · 12.7 kB CSS (+14 B) | — | — · — · — |
| Toolbar | 46.5 kB (+85 B) · 8.1 kB CSS (0) | — | — · — · — |
| TabList | 46.7 kB (+77 B) · 6.5 kB CSS (0) | — | — · — · — |
| ChatMessageList | 30.2 kB (+1 B) · 7.1 kB CSS (+21 B) | — | — · — · — |
| CommandPaletteInput | 33.9 kB (+1 B) · 7.6 kB CSS (+21 B) | — | — · — · — |
| Timer | 15.9 kB (0) · 6.1 kB CSS (+22 B) | — | — · — · — |
| Timestamp | 35.3 kB (0) · 10.6 kB CSS (+20 B) | — | — · — · — |
| ChatToolCalls | 34.4 kB (−1 B) · 8.4 kB CSS (+20 B) | — | — · — · — |
| Spinner | 26.8 kB (0) · 6.3 kB CSS (+19 B) | — | — · — · — |
| Heading | 14.4 kB (0) · 5.5 kB CSS (+18 B) | — | — · — · — |
| Text | 13.8 kB (−2 B) · 5.5 kB CSS (+18 B) | — | — · — · — |
| ProgressBar | 12.0 kB (+1 B) · 6.4 kB CSS (+12 B) | — | — · — · — |
| charts/ChartLegend | 53.9 kB (+1 B) · 224 B CSS (0) | — | — · — · — |
| LayerProvider | 4.4 kB (0) · 20 B CSS (0) | — | — · — · — |
| lab/LineClamp | 16.0 kB (−1 B) · 168 B CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.40 MB packed (+924 B); no new dependencies.
Wide change (shared styles: packages/core/src/Layer/layerAnimations.stylex.ts): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
The cap itself looks right: with the standard 4 px clearance, the entrance's first step now stops at the trigger's edge, and layers with more room keep the full step. One change is needed before approval:
- The changeset says no anchored layer's entrance starts over its trigger, but a layer flush against its trigger (
useLayer's defaultoffsetof 0) or partly over it (a submenu against its row) still takes the full 8 px step, so please narrow it, for example: "An anchored layer that has room to its trigger no longer starts its entrance over it: its first step toward the trigger stops at that room."
Two optional points are in the inline comments: test the floored gap rather than the raw one, and a comment wording fix. CI has not run on this head yet.
Claims and files checked
- Changeset: an anchored layer's entrance no longer starts over its trigger. False for layers flush against or partly over their trigger (
layerEntranceSide.ts:158writesinitial, so the step stays 8 px). - Changeset: the first step stops at the room between layer and trigger. Verified for layers with room (
layerEntranceSide.ts:92-111,layerAnimations.stylex.ts:51). - Changeset and description: a tall tooltip 4 px beside its trigger no longer covers it on its first frame in Safari. Consistent with the code (a 4 px step from the facing edge); the WebKit run was not repeated.
- Description: the side-aware entrance shipped in 0.7.14. Verified in the core changelog.
- Description: the step is
--spacing-2(8 px) and the Tooltip offset--spacing-1(4 px). Verified (tokens.stylex.ts:189-191,useTooltip.tsx:955). - Description: the runtime writes the room as a private custom property, the keyframes take the smaller of step and room, and larger room keeps the step. Verified (
layerEntranceSide.ts:155-161,layerAnimations.stylex.ts:51). - Description: a layer against or partly over its trigger writes no room and keeps the whole step. Verified (
layerEntranceSide.ts:158). - Description: the layer-runtime side-of-landing rule and the tall-content case it quotes. Verified (the quoted rule and the
TooltipTallContentspec case at line 354). - Description: the unit test gains the cap case and the against-the-anchor case. Verified (
layerEntranceSide.test.ts:85,:141); every expected object matches what the head's functions return. - Description: no public API change; internal
LAYER_ENTER_GAP_PROPERTYandLayerEntranceSide.gapadded. Verified (no package entry point exports the module). - Description: line counts. Verified (+45/-14 product, +28 tests, +7 changeset).
- Description: browser run counts, bisect, test-suite totals, typecheck, lint and bundle size. Not repeated; the spec files hold 13 tall-content cases and 10 entrance routes in two states, matching the stated counts.
.changeset/layer-entrance-step-off-trigger.md: the scope finding above.packages/core/src/Layer/layerAnimations.stylex.ts: clear.packages/core/src/Layer/layerEntranceSide.ts: two optional inline notes.packages/core/src/Layer/layerEntranceSide.test.ts: clear.
The gap guard now tests the floored value it writes, so room that floors to 0 px keeps the whole step. The changeset names only a layer that has room to its trigger.
|
/approve-spec 10dc5bd |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The pull request is a draft on a fork branch, so CI starts once it is marked ready for review and a maintainer adds the ci:run label.
The narrowed changeset and the floored no-room guard address the earlier review. Capping the step at the room keeps a layer with 4 px of clearance off its trigger on its first frame, and layers with 8 px or more keep the full step.
- Miss: (optional) under a CSS
zoomabove 1 on an ancestor, the room is measured in the box's px but the keyframes read it in the layer's own px, so a layer with room can still start over its trigger (1.25 px atzoom: 1.25); dividing by the layer'scurrentCSSZoomin the measurement pass would close it, as the inline comment shows.
Claims and files checked
- Claim: a layer that has room no longer starts its entrance over its trigger, and its first step stops at that room. Verified:
layerEntranceSide.ts:92-111and:156-160,layerAnimations.stylex.ts:51, and a Chromium frame-0 check of the keyframes. - Claim: a tall tooltip 4 px beside its trigger no longer covers it on its first frame in Safari. Verified in code (a 4 px room caps the step at 4 px); the WebKit runs are the author's.
- Claim: the regression dates from the side-aware entrance released in 0.7.14. Verified: the core changelog, and the bisect pair is consecutive on main.
- Claim: the step is the 8 px spacing token and the Tooltip's offset is the 4 px one. Verified:
tokens.stylex.ts:189-191,useTooltip.tsx:955. - Claim: the keyframes take the smaller of the step and the room, so a larger room keeps the step. Verified:
layerAnimations.stylex.ts:51, and a 20 px room keeps 8 px in Chromium. - Claim: a layer against or partly over its trigger writes no room and keeps the whole step. Verified:
layerEntranceSide.ts:92-111,:156-160. - Claim: the red-first browser case at line 354 is the tall-tooltip case that checks no entrance frame covers the trigger. Verified at that line; its WebKit runs are the author's.
- Claim: the unit test gains the cap, against-the-anchor and floored-room cases. Verified:
layerEntranceSide.test.ts:85-96,:141-151; they fail on the base. - Claim: PR CI runs the accessibility specs in Chromium only. Verified: the
test:a11y-contractscript and the PR contract runner pass--project chromium. - Claim: the browser runs, the full unit suite, typecheck, lint and the app-size numbers. Not reproduced here; the author's runs.
- Claim: no public API, an internal constant and
gapmember, and no new module or hook. Verified: the package exports and the diff. - Claim: the line counts. Verified.
- File
.changeset/layer-entrance-step-off-trigger.md: clear. - File
packages/core/src/Layer/layerAnimations.stylex.ts: clear. - File
packages/core/src/Layer/layerEntranceSide.ts: clear, with the optional zoom note. - File
packages/core/src/Layer/layerEntranceSide.test.ts: clear.
| side == null ? 'initial' : `${px(side.originX)} ${px(side.originY)}`, | ||
| ); | ||
| // Floored, so rounding never carries the step past the anchor's edge. | ||
| const gap = side == null ? 0 : Math.floor(side.gap * 1000) / 1000; |
There was a problem hiding this comment.
Optional, and a miss in the earlier review: under a CSS zoom above 1 on an ancestor, side.gap comes from getBoundingClientRect in the box's px, but min(--spacing-2, var(--_astryx-layer-enter-gap)) reads it as the layer's own px, which the zoom scales again. In Chromium a popover layer with 4 px of room still starts 1.25 px over its trigger under zoom: 1.25 (5 px before this change) and 8 px under zoom: 2 (unchanged). Dividing the room by the layer's currentCSSZoom, read in the measurement pass beside the boxes, would close it. settledBox.ts already notes the same unit gap for the computed translation and origin.
A shipped Safari regression fixed: a tall Tooltip's first entrance frame covered its trigger. Red-first: yes,
TooltipTallContent.a11y.browser.spec.ts:354fails on main in WebKit.User impact
People who hover or focus a trigger in Safari whose tooltip opens beside it, with motion allowed. Since v0.7.14, an anchored layer's entrance starts one step toward its trigger. A tall Tooltip sits 4 px beside its trigger, so the first frame of its 8 px step painted it over the trigger. Any anchored layer with less room to its trigger than one step did the same.
Problem and solution fit
#10771 (19eadab, shipped in v0.7.14) made an entrance slide from the side its layer lands on. The step is
--spacing-2, 8 px, and the Tooltip's offset is--spacing-1, 4 px. So the step started 4 px over the trigger, and WebKit paints that first frame.The runtime now writes the room between the layer and its trigger on the step's axis, as
--_astryx-layer-enter-gap. The shared entrance keyframes take the smaller of the step and that room. Where the room is larger, the step is unchanged. A layer against or partly over its trigger, as a menu at the pointer, writes no room and keeps the whole step.Expected behavior and authority
architecture:layer-runtimeINV20: an entrance starts from the side its layer lands on, "So it never slides onto its trigger."Smallest restoration
One custom property the runtime writes, and the step in the shared entrance keyframes. Where the room exceeds the step, nothing visible changes.
Evidence
:354case, plus a unit test for the cap and for a layer against its anchor.Scope
Components: Layer, and every anchored layer's entrance (Tooltip, HoverCard, Popover, DropdownMenu, ContextMenu, Selector)
Testing
All runs below are at this PR's head, 10dc5bd, on a Storybook built at it. CI runs the a11y specs in Chromium only, so the WebKit runs are by hand, in the CI-profile WebKit container (
internal/interaction-harness/scripts/webkit-container.mjs).TooltipTallContent.a11y.browser.spec.ts:354,--repeat-each=5TooltipTallContent.a11y.browser.spec.ts, all casesLayerEntranceSide.interaction.browser.spec.tslayerEntranceSide.test.tsgains the cap case, the against-its-anchor case and a room that floors to 0 px.pnpm exec vitest run --project ui: 1001 files, 24723 tests pass.@astryxdesign/coretypecheck: 0 errors. ESLint and Prettier on the changed files: clean.Public and internal API delta
Public: none.
Internal, added:
layerEntranceSide.tsexportsLAYER_ENTER_GAP_PROPERTY, the name of the private--_astryx-layer-enter-gapproperty, beside the three entrance property names it exports already. The unit test reads the written value through it.Usage:
layer.style.getPropertyValue(LAYER_ENTER_GAP_PROPERTY)Internal, changed:
LayerEntranceSidegainsgap, the room between the layer and its anchor on the step's axis, in px.writeLayerEntranceSidewrites it, so the step stops short of the anchor.Usage:
const {x, y, gap} = layerEntranceSide(layerBox, anchorBox);Internal, added: the runtime writes
--_astryx-layer-enter-gapon a shown anchored layer, beside the entrance properties it writes already. It is private, and a theme does not set it. The shared keyframes read it.Usage:
translate(calc(var(--_astryx-layer-enter-x, 0) * min(<step>, var(--_astryx-layer-enter-gap, <step>))), …)No new module or hook: the cap extends
layerEntranceSide.ts, which already computes and writes the entrance's side.Lines: product +44/−14 (
layerEntranceSide.ts+31/−5,layerAnimations.stylex.ts+13/−9), tests +33/−0, changeset +7/−0.App-level size: a minimal Vite app that renders a Popover and a ContextMenu, built for production. Its eager gzip grows by 85 B of JS and 24 B of CSS against main 06b7e61. JS goes from 271,605 to 271,690 B, and CSS from 26,913 to 26,937 B.