Skip to content

fix(Layer): an exit copy keeps the padding and colors of what it copies - #11796

Merged
cixzhang merged 2 commits into
meta:mainfrom
vjeux:exit-copy-keeps-padding
Nov 15, 2026
Merged

cixzhang merged 2 commits into
meta:mainfrom
vjeux:exit-copy-keeps-padding

Conversation

@vjeux

@vjeux vjeux commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Base: main 270f680.

User impact

A touch close plays on an exit copy of the closing surface. The browser's popover style padded, bordered and painted that copy. A surface with no padding of its own then drew its content inset during the close. On #8080's head, a DropdownMenu's close drew its rows 4 px right and down, and 8 px narrower. Popover's own padding hides the defect today.

Problem and solution fit

placeLayerExitCopy clones the element it is given and shows the clone as a manual popover. So the user agent's [popover] rule applies to the clone: padding: 0.25em, border: solid, color: CanvasText and background-color: Canvas.

The element is often no popover. Popover's surface motion copies the surface inside the layer. Where that surface sets no padding, border or colors, the copy gains the browser's.

The copy already keeps the element's overflow for the same reason. It now also keeps the element's own padding, border and colors, as inline styles from its computed style.

Expected behavior and authority

architecture:layer-runtime INV13: an exit copy is drawn where the layer was drawn. Its Exit copy section now says that the copy keeps the padding, border, and colors of the element it copies.

Smallest restoration

One list holds the 18 longhands the popover rule sets that the copy did not yet keep. A loop writes each from the element's computed style. No new API, attribute or default.

Evidence

  • Reproduction before the change: with main's layerExitCopy.ts, a surface's copy draws its text 7 px off in Chromium and WebKit. A unit case finds no padding, border or colors written.
  • Result after the change: both cases pass. The copy's text box equals the live text box within 0.5 px.
  • Representative unchanged path: Popover's three interaction spec files and DropdownMenu's five pass in both engines.
  • Regression test or other mutation-sensitive proof: both new cases fail with main's layerExitCopy.ts and pass with this change.

Scope

Components: the layer runtime's exit copy

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

R1 narration, R2 research, R4 rejected alternatives, R5 change references, R6 open questions, R7 project status: none. R3 evidence: INV13's verification names the exit copy's unit and browser tests.

Testing

At f25d71c. d6a5376 holds the fix on main 270f680. f25d71c lets the browser's own popover style reach the copy in the browser case.

  1. Red first, with main's layerExitCopy.ts and the new cases. pnpm exec vitest run --project ui packages/core/src/Layer/layerExitCopy.test.ts fails "keeps the padding, border and colors of what it copies". __tests__/layerExitCopy.interaction.browser.spec.ts fails its new case in Chromium and in WebKit's CI container. There the copy's text sits 7 px off the live text: the browser's popover padding and border. The file's five other cases pass.
  2. With the change: the unit file passes (30). The browser file passes in Chromium (12) and WebKit (12), over 2 repeats.
  3. The exit copy's users: Popover plays its touch close on it, and so do DropdownMenu's menus in feat(DropdownMenu): a finger's open grows the menu out of its trigger #8080. Popover's interaction specs (PopoverFocusReturn, PopoverKeyboard, PopoverTouchMotion) pass in Chromium (31) and WebKit (22 pass, 9 skip). DropdownMenu's five interaction spec files pass in Chromium (26) and WebKit (23 pass, 3 skip).

Local gates: the ui project (25,822), the core type check, pnpm check:knowledge, pnpm check:repo and pnpm review:pre pass. ESLint reports no error, and no warning on a changed line. The Node project passes 23,733 cases and fails one in privacy-contract.test.mjs: this machine sets AGENT_SESSION_ID, which the tested code reads. This pull request changes no file under packages/cli. The ui and Node projects ran on a tree that differs only in a comment and that browser file's test code. Every other run here is at this head.

Public and internal API delta

None. No export, prop, type, default or attribute changes. POPOVER_STYLE_PROPERTIES is private to layerExitCopy.ts.

  • Size: +128/−7 lines (270f680..f25d71c). Measured as .github/scripts/lib/component-size.js measures an import: the size report's esbuild options, eager chunks only. A Popover page gains 99 B gzip, and a 12-component page with Popover, Dialog and BottomSheet gains 132 B. architecture:component-import-boundaries INV10's docs, form, menu and table pages are unchanged. The byte sizes come from a build whose product code differs from this head only in a comment.

@vercel

vercel Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 14, 2026 11:12pm UTC

Request Review

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

astracat-bot Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 14, 2026, 11:21 PM UTC

@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f25d71c

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
LayerProvider 4.4 kB (0) · 20 B CSS (0) — ✓ · ✓ · ✗
lab/ChatReactionBar 114.6 kB (+115 B) · 1.1 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 113.5 kB (+110 B) · 773 B CSS (0) — — · — · —
7 more components
Component Size LoC Visual · A11y · RTL
Popover 98.5 kB (+100 B) · 15.1 kB CSS (0) — — · — · —
lab/Comments 369.6 kB (+98 B) · 2.5 kB CSS (0) — — · — · —
lab/CommentComposer 162.6 kB (+96 B) · 1.9 kB CSS (0) — — · — · —
lab/CommentThread 362.3 kB (+95 B) · 2.4 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 299.4 kB (+89 B) · 454 B CSS (0) — — · — · —
layer — — — · ✓ · —
Layer — — ✓ · ✓ · —

Package size: @astryxdesign/core 7.59 MB packed (+567 B); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec d6a5376

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 14, 2026

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes requested: the exit-copy fix is correct, and one count in the description needs correcting.

  • The description says DropdownMenu's six interaction spec files pass (in Evidence and in Testing step 3), but this head has five, which hold the 26 cases it reports, so change "six" to "five" in both places.

The copy now keeps the copied element's padding, border and colors, which matches the layer runtime's rule that a copy is drawn where the layer was drawn, and both new cases fail without the change and pass with it. The optional note on the browser fixture's [popover] rule (inline, line 162) still applies: excluding the copy from that rule would let the position check catch a lost padding too. CI has not run on this draft yet.

Claims and files checked

Review mode: same-head; reason: none

  • Changed rule, incremental re-review now lists each changed rule with its result: checked: the five changed files at this head, the earlier review of this head and both rule versions, no finding.
  • Changed rule, the review mode line gains reasons for a changed rule set: checked: this review's mode against the earlier review of this head, no finding.
  • Release note: the exit copy keeps the copied element's padding, border and colors: verified (layerExitCopy.ts:293-295, unit case).
  • Release note: before, the browser's popover style padded, bordered and painted the copy: verified (base copy: 4 px padding, a 3 px border without a reset stylesheet, the popover background in the browser case).
  • Release note: a surface with no padding of its own drew its content inset during the close: verified (4 px right and down, 8 px narrower at the base; none at the head).
  • Release note: this is the copy a touch close plays on: verified (touch gate, usePopoverSurfaceMotion.ts:109-112).
  • Description: the copy is a manual popover, so the browser's popover rule applies: verified (layerExitCopy.ts:239).
  • Description: Popover's touch motion copies the surface inside the layer: verified (usePopoverSurfaceMotion.ts:120).
  • Description: the copy already kept the element's overflow: verified (layerExitCopy.ts:286-289).
  • Description: one private list of 18 longhands and one loop, no new API, attribute or default: verified (layerExitCopy.ts:66-85; no public API rows).
  • Description: on the DropdownMenu branch the rows moved 4 px and lost 8 px of width: consistent (the same numbers reproduce in a fixture).
  • Description: Popover's own padding hides the defect today: verified with Core's reset stylesheet; without it the old copy also draws a 3 px border.
  • Description: both new cases fail with the old file and pass with the change: verified (unit; Chromium).
  • Description: the unit file passes (30) and the browser file passes: verified (unit 30 of 30; browser 6 of 6 in Chromium).
  • Description: Popover's three interaction spec files pass: verified (31 cases, Chromium).
  • Description: DropdownMenu's six interaction spec files pass (26): false at this head (five files, 26 cases).
  • Description: no file under the CLI package changes: verified.
  • Description: +125/-5 lines, Popover +99 B gzip, the four reference pages unchanged: verified.
  • Description: no lint error or warning on a changed line, the knowledge check and the core type check pass: verified.
  • Description: WebKit counts, the full UI and Node suites, the repository checks and the 12-component page size: not rerun.
  • File .changeset/exit-copy-keeps-padding.md: clear.
  • File docs/architecture/layer-runtime.md: clear.
  • File packages/core/src/Layer/layerExitCopy.ts: clear.
  • File packages/core/src/Layer/layerExitCopy.test.ts: clear.
  • File packages/core/src/Layer/__tests__/layerExitCopy.interaction.browser.spec.ts: non-blocking note on the fixture's [popover] rule.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec f25d71c

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending CI: CI has not run on this head yet, because the pull request is a draft from a fork; once it is ready for review, a maintainer adds the ci:run label so CI runs.

The exit copy now keeps the copied element's padding, border and colors, which matches the layer runtime's rule that a copy is drawn where the layer was drawn. Both earlier points are addressed: the description now counts five DropdownMenu interaction spec files, and the browser fixture lets the popover style reach the copy, so the new browser case fails 7 px off without the fix and passes with it.

Claims and files checked

Review mode: incremental; reason: none

  • Release note: the exit copy keeps the copied element's padding, border and colors: verified (layerExitCopy.ts:293-295; the new unit and browser cases).
  • Release note: before, the browser's popover style padded, bordered and painted the copy: verified (with the base code the browser case's copied text sits 7 px off, and a fixture copy takes 4 px padding and black text).
  • Release note: a surface with no padding of its own drew its content inset during the close: verified (fixture: 4 px right and down, 8 px narrower with the base code; identical to the live surface with this change).
  • Release note: this is the copy a touch close plays on: verified (touch gate, usePopoverSurfaceMotion.ts:109-112).
  • Description: on the DropdownMenu touch branch the menu rows moved 4 px right and down and lost 8 px of width: verified by reproduction (the same numbers in a fixture with Core's reset; that branch itself not run).
  • Description: Popover's own padding hides the defect today: verified (Popover's default surface padding, Popover.tsx:531).
  • Description: the copy is a manual popover, so the browser's popover rule pads, borders and paints it: verified (layerExitCopy.ts:239; fixture computed style).
  • Description: Popover's touch motion copies the surface inside the layer: verified (usePopoverSurfaceMotion.ts:120).
  • Description: the copy already kept the element's overflow: verified (layerExitCopy.ts:288-289).
  • Description: the layer runtime record's Exit copy section now says the copy keeps padding, border and colors: verified (layer-runtime.md:347-348).
  • Description: one private list of 18 longhands and one loop, no new API, attribute or default: verified (layerExitCopy.ts:66-85; no public API rows for Core, the themes or the build package).
  • Description: both new cases fail with main's file and pass with this change: verified in Chromium and the unit runner; WebKit not run.
  • Description: the unit file passes (30) and the browser file passes in Chromium (12 over two repeats): verified; WebKit not run.
  • Description: Popover's three and DropdownMenu's five interaction spec files pass: file counts verified (three and five); Chromium pass counts carried from the previous review of identical product code; WebKit not run.
  • Description: ESLint reports no error and no warning on a changed line: verified (23 warnings, none on a changed line).
  • Description: the knowledge check and the core type check pass: verified.
  • Description: no file under the CLI package changes: verified.
  • Description: +128/−7 lines, a Popover page +99 B gzip, the four reference pages unchanged: line counts verified; sizes carried from the previous review of identical product code; the 12-component page size not rerun.
  • Description: the full UI and Node suites, the repository checks and the pre-review check pass: not rerun.
  • File .changeset/exit-copy-keeps-padding.md: clear.
  • File docs/architecture/layer-runtime.md: clear.
  • File packages/core/src/Layer/layerExitCopy.ts: clear.
  • File packages/core/src/Layer/layerExitCopy.test.ts: clear.
  • File packages/core/src/Layer/__tests__/layerExitCopy.interaction.browser.spec.ts: clear.

Automated review (maintainer link)

@cixzhang cixzhang added ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) labels Nov 14, 2026
@vjeux
vjeux marked this pull request as ready for review November 15, 2026 12:46
@cixzhang
cixzhang merged commit 8c8dd05 into meta:main Nov 15, 2026
159 checks passed
@vjeux
vjeux deleted the exit-copy-keeps-padding branch November 15, 2026 14:06

This branch was successfully deployed

1 active deployment
Preview — f25d71cc Deployed Nov 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants