Skip to content

fix(Lightbox): an open caption shrinks without a forced layout - #11539

Merged
cixzhang merged 29 commits into
meta:mainfrom
vjeux:fix/lightbox-caption-shrink-layout
Nov 18, 2026
Merged

cixzhang merged 29 commits into
meta:mainfrom
vjeux:fix/lightbox-caption-shrink-layout

Conversation

@vjeux

@vjeux vjeux commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

An open Lightbox caption that widens to fewer lines no longer forces a layout as it shrinks, with the exceptions below. A "more" tap keeps its one forced layout, now recorded and pinned by a test.

User impact

A phone turned sideways, or a wider window, gives an open caption fewer lines. The frame that shrank it then read the caption after a write, forcing an extra layout. Where "less" sits does not change.

Problem and solution fit

  • Why the read came after a write: the frame measured after committing the smaller count. It needed to know whether "less" still fits beside the last line.
  • The fix: the delivery that sees the caption widen already reads its layout, so it picks the count there. The frame only writes that count, and the caption's delivery in that frame reads the result.
  • The exceptions: the check measures text, inline elements, inline-blocks, images and plain blocks. Anything else takes main's exact read, one forced layout. That covers floats, drop caps, flex, grid and clipped blocks, empty inline-blocks, offsets, transforms and other writing modes. It also covers room under the text's last line, list markers, text indents, justified last lines, and generated content outside inline elements.

Expected behavior and authority

This pull request adds a line to Lightbox's current-state impact: a "more" tap takes one forced layout, placing "less" in the first frame.

Smallest restoration

  • measureCaptionLines picks the smaller count in its delivery. When the caption shows one line more than its text, placeFitsBesideLastLine checks whether the toggle's place fits beside the last line. It measures that line's boxes, with inline padding, borders, margins and generated content, and an inline-block as one box. It compares their width with the room beside the place. With more extra lines, the frame's own delivery corrects the count.
  • The frame commits that count with flushSync.
  • Unchanged: the tap, the clamped caption, paging.
  • The record's new line, and its FR1 verification cell, name the layout count.

Evidence

  • Reproduction before the change: at 402 × 874, open a long caption, then turn to 874 × 402. The shrink frame reads clientHeight after a write, in both engines.
  • Result after the change: that frame reads nothing, outside the exceptions.
  • Representative unchanged path: the fit case passes on main's build too, so "less" sits as on main.

Scope

Components: Lightbox

  • 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.

Testing

  • Red first: a new case watches the frame callbacks as an open caption widens to fewer lines. On 22213fd's build it fails in Chromium and WebKit, 2 of 2 each, with a clientHeight read. It passes here, for plain, paragraph and centred captions. For a paragraph with its own ::after words, it expects exactly one clientHeight read, as main does. At 2177a78 that case reads nothing and fails. It expects one read for a paragraph with bottom padding and a caption ending in two line breaks too. At 83e626e both read nothing and fail in both engines.
  • The fit: a new case widens an open caption from 360 px to each width that leaves its text one line fewer. It fails where "less" takes a line of its own though it fits, or shares a line it does not fit. At every width it also fails where "less" is off the line its place keeps clear. It fails too where the place moves a word to a new line. Layout itself says whether "less" fits. The case lays the text out alone, then with the place beside its last line, and compares the flow's lines. At 2177a78 it fails in both engines for a caption ending in visually hidden text, and for paragraphs with generated content after their text. At 2614600 it fails in both engines for ten more captions, at the same widths unless noted. A clipped chip fails at 422–434 px, an inline element's generated words at 422–428 px, and a contents element's at 364–368 px. A float fails at 414–444 px, an inside marker at 392–422 px, and a text indent at 414–444 px. A drop cap fails at 420–450 px in Chromium and 424–454 px in WebKit. A flex row fails at 410–496 px, a justified last line at 418–496 px, and an offset element at 418–438 px. A block that clips its overflow passes there too, and now takes the exact read. Main's own sweep now runs those two captions. At 83e626e it fails in both engines for four more captions. The padded paragraph, the one with a bottom rule and two line breaks fail at 430–434 px. The empty inline-block fails at 362 px. It passes here, and on main with the fixture stories.
  • WebKit's share of the sweep: WebKit sweeps eight of the 30 captions. They are plain text right to left, a drop cap and generated words. They add one ending of each kind the fit rules tell apart. Those are bottom padding, a bottom rule, two line breaks, an empty inline-block and an image. Each of those endings follows plain text left to right, which runs in Chromium only. Chromium sweeps all 30. Both caption sweeps, main's two-caption one included, turn the backdrop's blur off, as a drag to dismiss does. With the blur on, each WebKit frame that resizes the page took about 105 ms; with it off, about 27 ms. Caption layout does not read the blur. On main's Lightbox with this head's stories, the sweep passes in both engines, as before. With 0da50f9's fix reversed, it fails in both engines for the same four captions as at 83e626e, at the same widths.
  • The fixture captions: new GalleryWithParagraphCaptionFixture and GalleryWithCenteredParagraphCaptionFixture stories pass the long caption as a <p>, the second one centred. GalleryWithCaptionsInFrameFixture shows the gallery with captions in a same-origin iframe that fills the page. GalleryWithImageCaptionFixture ends the long caption with an inline icon. GalleryWithBlockImageCaptionFixture ends it with a plain icon, which the reset makes a block. GalleryWithPaddedEndCaptionFixture and GalleryWithMarginEndCaptionFixture end it in end padding and an end border, and in an end margin. GalleryWithGeneratedContentCaptionFixture and GalleryWithInlineBlockCaptionFixture end it in generated content and in an inline-block element. GalleryWithVisuallyHiddenCaptionFixture ends it in absolutely positioned, clipped text, as a screen-reader-only class lays it out. GalleryWithParagraphGlyphCaptionFixture and GalleryWithParagraphWordsCaptionFixture pass it as a paragraph whose own ::after adds a glyph, or words. GalleryWithPaddedParagraphCaptionFixture passes it as a paragraph with 64 px start padding. GalleryWithEndAlignedParagraphCaptionFixture passes it as one aligned to its end, ending in end padding and an end border. GalleryWithClippedChipCaptionFixture ends it in an inline-block chip whose text ends in an ellipsis. The chip sits at the line's bottom. With its default baseline it makes its line taller, and then the place mislays "less" on main too. GalleryWithInlineWordsCaptionFixture ends it in an inline element whose own ::after adds words. GalleryWithContentsWordsCaptionFixture wraps it in a display: contents element that does the same. GalleryWithFloatCaptionFixture, GalleryWithInsideMarkerCaptionFixture and GalleryWithIndentedParagraphCaptionFixture pass two blocks. The last block's first line starts with a 64 px float, an inside marker, or a 64 px indent. GalleryWithDropCapCaptionFixture passes two blocks too; the last one starts with a floated first letter two lines tall. GalleryWithJustifiedLastLineCaptionFixture passes it as a paragraph with its last line justified. GalleryWithOffsetEndCaptionFixture ends it in an element moved 48 px by a relative offset. GalleryWithBottomPaddedParagraphCaptionFixture and GalleryWithBottomRuleParagraphCaptionFixture pass it as a paragraph with 16 px bottom padding, the second with a bottom rule. GalleryWithTrailingBreakCaptionFixture and GalleryWithTrailingEmptyInlineBlockCaptionFixture end it in two line breaks, and in an empty inline-block 24 px wide. Two cases run right to left, through Storybook's direction global. All twenty-seven stories are tagged no-visual and !autodocs. The captions ending in a flex row and in a block that clips its overflow come from main, with their sweep.
  • The pin: a new case counts the layouts in a "more" tap's task, from a Chromium rendering trace. It reads exactly 1 here and on main's build, for a plain caption and for the paragraph with its own ::after words. Here it passes 100 of 100 runs for each caption. Trace marks now bound its window. Chromium coarsens performance.now() to 100 µs, with jitter. The button's activation lays out the commit's changes within that time after the bubble listener. So the old window counted that layout in 2 of 100 runs at 2614600, and 1 of 100 on main's code. The case for opening a gallery shares the window.
  • CI time: CI cancelled the second WebKit leg at its 15-minute limit, inside the fit sweep. There, each of the sweep's instances took 41–57 s. The leg planner, run locally on this head, plans the same two legs. On 4 CPUs with 1 worker, the second leg's 9 spec files run in 8.7 min: 158 tests pass and 39 skip. On the 78 tests both runs share, CI took 22% longer, and its setup took 1.6 min. So the leg should take about 12.2 minutes there, under the job's 15-minute limit. WebKit's eight sweeps take 7.6–14.8 s each, and main's two take 11.3 s, down from 34.5 s. Chromium's 32 take 3.5–8.1 s each.
  • Gates at 4a9176b: core tsc is clean, and strict ESLint has no warnings on the changed spec. pnpm check:knowledge and check:changesets pass. The unit files under Lightbox, Text, TextInput, TextArea, Link, Icon, motion, Layer, Tooltip and theme pass 4,642/4,642. That count includes the hit-area, node-type and press-feedback unit files. On 4 CPUs with 1 worker, as in CI, the Lightbox interaction specs pass 194 (4 skips) in Chromium and 162 (36 skips) in WebKit. WebKit's 22 new skips are the sweep's shapes it leaves to Chromium. The pin passes 100 of 100 runs for each caption. The pull request's a11y selection names 26 specs: the 23 that every pull request runs, and three Lightbox specs. With every spec under Lightbox, Text and Link, they pass 319 in Chromium. Lightbox's a11y specs pass 83 (2 skips) in WebKit; Text, TextInput and TextArea have none there. pnpm review:pre reports no findings and a clean merge.

Lines (b31d8b3..4a9176b): +1649/−40 in all: source +460/−8, tests and the fixture stories +1178/−31, and the record and the changeset +11/−1.

Writing rubric results

  • R1 narration: none. The new current-state line states what a "more" tap does.
  • R2 research: none in the record.
  • R3 evidence: FR1's verification cell names the LightboxPaging layout count, not a pull request.
  • R4 rejected alternatives: none.
  • R5 change references: none.
  • R6 open questions: none.
  • R7 project status: none. The line states a fact, with no plan or phase.

Public and internal API delta

None. No export, prop, type, default, hook, module or data attribute changes.

  • Size: +1,617/−40 lines (5628141..9b4100d). core/Lightbox's eager import: +1,799 B gzip (149,289 → 151,088), CSS +0 B (12,217), from the repository's component size report.

History

An open caption that widens to fewer lines shrinks in the next frame.
That frame commits the smaller count, then reads the caption, which
forces a layout. The new case watches the frame callbacks and fails on
the read.
The delivery that sees the caption widen already reads its layout, so
it now picks the count there. When the caption shows one line more
than its text, that includes whether the toggle fits beside the last
line. The next frame only writes that count, and the caption's
delivery in that frame reads the result.
The band cannot grow from its own resize report without looping, so a
"more" tap lays the open caption out once to place "less" in the first
frame. The record states it, and a case counts the layouts in the tap.
@vercel

vercel Bot commented Nov 13, 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 18, 2026 12:46pm UTC

Request Review

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

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 18, 2026, 12:48 PM UTC

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

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · f97cc5b

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Lightbox · Storybook 149.6 kB (+1.8 kB) · 12.0 kB CSS (0) 5,400 (+354) ✗ · ✓ · ✓
lab/Comments 379.1 kB (+1.7 kB) · 2.5 kB CSS (0) — — · — · —
lab/CommentThread 372.3 kB (+1.7 kB) · 2.4 kB CSS (0) — — · — · —
Visual changes: 2 snapshots in 1 component

A change is a question for the reviewer, not a failure.

Component · story Before After Diff
Lightbox · Default (neutral, dark) · inheritance unknown: not found in the 5 newest reports of other pull requests before frame after frame diff frame
Lightbox · Default (neutral, light) · inheritance unknown: not found in the 5 newest reports of other pull requests before frame after frame diff frame

Inheritance checked against the 5 newest reports of other pull requests.

Package size: @astryxdesign/core 7.68 MB packed (+8.2 kB); 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 67e9f39

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 13, 2026
@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 13, 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 shrink frame's forced layout is gone, but the new fit check misplaces "less" for captions that hold a block element.

  • placeFitsBesideLastLine (Lightbox.tsx:208-219) counts a block child's full-width box as the caption's last line, so a <p>-wrapped caption keeps "less" alone on an extra line after a widening that leaves one extra line (6 lines at 400 px where the base shows 5 with "less" beside the text), which also makes "Nothing a person sees changes" untrue.

Build the last line from text-node rects only, add a block-caption case to the frame test, and either drop the half-pixel lean or mention it in the description, since a plain caption at 446 px also keeps "less" on its own line where the base fit it. The new frame case fails on the base and passes here in Chromium, so the fix itself is proven. Two optional suggestions are inline: the record line's FR1 attribution and the helper's comment wording.

Claims and files checked
  • Claims: the frame that shrinks an open caption no longer forces a layout: verified (the frame callback only commits; the new case fails on the base with a clientHeight read and passes here, Chromium).
  • Claims: a "more" tap keeps exactly one forced layout: verified (the pin counts 1 on the base and here, Chromium).
  • Claims: the observer delivery picks the count, the frame only writes, and that frame's delivery corrects a count that needs the toggle's own line: verified in the code; the caption interaction cases pass.
  • Claims: nothing a person sees changes, and "less" still ends the last line after the turn: false for captions with a block element, and for plain text in a half-pixel band (blocking finding).
  • Claims: the "more" tap, the clamped caption and paging are unchanged: verified (the diff does not touch them).
  • Claims: the record's new line and its FR1 verification cell name the layout count: verified; attribution suggestion inline.
  • Claims: red first in Chromium and WebKit, then passing: verified in Chromium; WebKit not run here.
  • Claims: typecheck, knowledge check, unit and browser suites pass: typecheck, knowledge check, the Lightbox unit files and the caption interaction cases pass here; the rest were not rerun.
  • Claims: +241/−9 lines and no public or internal API change: verified (API report shows no rows).
  • Claims: writing rubric reports no narration, status or change references in the record: verified.
  • Claims: changeset, a Core patch for the shrink frame's forced layout: verified.
  • Files: packages/core/src/Lightbox/Lightbox.tsx: blocking finding in the fit check; comment wording suggestion.
  • Files: packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: clear (red-first proven); the pin's title says more than it asserts.
  • Files: docs/specs/components/Lightbox/Lightbox.spec.md: non-blocking attribution suggestion.
  • Files: .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Lightbox/Lightbox.tsx Resolved
Comment thread packages/core/src/Lightbox/Lightbox.tsx Resolved
Comment on lines +107 to +109
- **Long caption's "more" (FR1).** A "more" tap takes one forced layout to
place "less" in the first frame, since the band cannot grow from its own
resize report without looping.

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.

Optional: this section lists "the requirement it misses", and FR1 says nothing about layout counts, so the line reads as an FR1 gap. The read this records touches architecture:react-component-runtime INV18; citing that (or keeping the reason only in the code comment and the test) would keep FR1's row clean.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept as is. The current-state notes name the requirement whose behavior they describe, as the FR14 double-click and press-tracker notes do. FR1 defines "more" and where "less" sits. INV18 allows one read per change that names its reason, so this read is not an INV18 gap.

After an open caption widens to one line fewer, its count depends on
whether "less" fits beside the text's last line. A new case checks each
such width from 360 px, for a plain caption and, through a new fixture
story, a paragraph caption. The frame case also runs on both.
The check that "less" fits beside the last line took a paragraph's box
for the caption's last line, so "less" got a line of its own. It now
reads the lines of the text nodes only, and compares them without a
half-pixel lean, as layout does.
The case counts one forced layout in a "more" tap, so its title says
that, and its comment cites no record.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 0d5177a

@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 shrink frame's forced layout is gone, and plain, right-to-left and start-aligned paragraph captions lay out exactly as on main, but the fit check still misplaces "less" for centered caption content.

  • placeFitsBesideLastLine (Lightbox.tsx:229-231) compares the last line's end edge with the caption's edge, so a centered paragraph caption keeps "less" alone on an extra line after a widening that leaves its text one line fewer (7 lines at 380–386 px where main shows 6 with "less" beside the text), which also makes "Nothing a person sees changes" untrue for such captions.

Comparing the last line's extent with the flow's width (max(right) − min(left) + needed <= box.width) covers start, center and end alignment in either direction, and a centered-paragraph entry in the fit sweep's CAPTION_STORIES would pin it. The new frame case fails on main's source and passes here in Chromium, so the fix itself is proven.

Claims and files checked
  • Claim: an open caption that widens to fewer lines no longer forces a layout in the shrink frame: verified (the frame case fails on main's source with a clientHeight read and passes here, Chromium).
  • Claim: a "more" tap keeps exactly one forced layout, now recorded and pinned: verified (the pin counts 1 on main's source and here; the record line is added).
  • Claim: the old frame read the caption after its write to learn whether "less" still fits: verified in the base code.
  • Claim: the delivery picks the count, the frame only writes it, and that frame's delivery corrects a count that needs the toggle's own line: verified in the code.
  • Claim: the fit check reads only the text nodes' lines, with the place below them, and compares exactly: verified in the code.
  • Claim: nothing a person sees changes: false for centered block captions (finding above); verified for plain, right-to-left and start-aligned paragraph captions, identical at 180 widths each.
  • Claim: a long caption open while a phone turns from portrait to landscape: verified; the frames are pixel-identical.
  • Claim: plain and paragraph captions widened from 360 px lay out as on main: verified up to 720 px in Chromium; wider widths and WebKit not rerun.
  • Claim: the tap, the clamped caption and paging are unchanged: verified (untouched by the diff; the caption interaction cases pass).
  • Claim: the record line and FR1's verification cell name the layout count: verified.
  • Claim: red first in Chromium and WebKit: verified in Chromium for both captions; WebKit not rerun.
  • Claim: the fit case passes here and on main with the fixture story: verified in Chromium; the previous head was not rerun.
  • Claim: the paragraph fixture story is tagged no-visual and !autodocs: verified.
  • Claim: typecheck, strict lint on the changed files, knowledge and changeset checks pass: verified; the Lightbox unit files pass 175 of 175; the wider unit, record, interaction and accessibility counts were not rerun.
  • Claim: +388/−9 lines with the stated split: verified.
  • Claim: the writing rubric finds no narration, research, status or change references in the record: verified.
  • Claim: no public or internal API change: verified (the API generator reports no rows; no new module).
  • File packages/core/src/Lightbox/Lightbox.tsx: blocking finding in the fit check.
  • File packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: clear; the fit sweep covers start-aligned captions only.
  • File apps/storybook/stories/Lightbox.stories.tsx: clear.
  • File docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • File .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Lightbox/Lightbox.tsx Resolved
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b7d4c8a

A centred caption's last line sits in the middle of its box, so its end
edge says nothing about the room beside it. The fit sweep now compares
the line's width, plus the toggle's place, with the caption's width,
which holds for any alignment. It and the frame case also run on a
centred paragraph caption, from a new fixture story.

@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 shrink frame no longer forces a layout, and plain and start-aligned paragraph captions lay out exactly as on main, but the new fit check still misplaces "less" for centered and end-aligned caption content.

  • placeFitsBesideLastLine (Lightbox.tsx:229-231) compares the last line's end edge with the caption's edge, so a centered or end-aligned paragraph caption keeps "less" alone on an extra line after a widening that leaves its text one line fewer (opened at 360 px in the interaction suite's phone profile: centered at 380–386 px, end-aligned at 380–442 px, where main ends the last line with "less"), which also makes "Nothing a person sees changes" untrue for those captions.

Comparing the last line's extent with the flow's width (max(right) − min(left) + needed <= box.width) holds for any alignment in either direction. The fit sweep's oracle (LightboxPaging.interaction.browser.spec.ts:2234) makes the same end-edge assumption, so it needs the same extent comparison before centered and end-aligned entries in CAPTION_STORIES can pin the fix; with it, those entries fail on this head and pass on main.

Claims and files checked
  • Claim: an open caption that widens to fewer lines no longer forces a layout in the frame that shrinks it (title, changeset): verified; the same frame instrumentation reads clientHeight after a write on main and nothing with this change, for a plain and a paragraph caption.
  • Claim: the old frame read the caption after its write to learn whether "less" still fits: verified in main's code.
  • Claim: the delivery picks the count, the frame only writes it, and with more extra lines the next delivery corrects the count: verified in the code and by the widths where the text loses two lines, which match main.
  • Claim: the fit check reads only the text nodes' lines, with the place below them, and compares exactly as layout does: the reads are verified; "as layout does" holds only for start-aligned last lines (finding above).
  • Claim: nothing a person sees changes: false for centered and end-aligned paragraph captions (finding above); verified for plain and start-aligned paragraph captions at 100 widths and for a phone turned sideways (identical frames).
  • Claim: a "more" tap keeps one forced layout, now recorded and pinned: verified; the tap's code is unchanged, the record line and its verification cell are added, and the new trace case passes.
  • Claim: the tap, the clamped caption and paging are unchanged: verified; the diff does not touch them.
  • Claim: the paragraph fixture story is tagged no-visual and !autodocs: verified.
  • Claim: the new frame cases fail before the change and pass with it: verified in Chromium with the same instrumentation on main; WebKit not rerun.
  • Claim: the fit cases pass here: verified in Chromium for both captions; their oracle cannot detect centered or end-aligned misplacement (above).
  • Claim: typecheck, strict lint on the changed files, and the knowledge and changeset checks pass; the Lightbox unit files pass: verified (175 of 175); the wider unit, record, interaction and accessibility totals were not rerun.
  • Claim: +388/−9 lines with the stated split: verified.
  • Claim: the merge of main leaves this pull request's own changes unchanged and brings the scoping of the Lightbox keyboard and viewport accessibility specs: verified.
  • Claim: the record line has no narration, research, status or change references: verified.
  • Claim: no public or internal API change: verified; the API surface generator reports no rows, and no module or data attribute is added.
  • Changeset: a @astryxdesign/core patch whose fix line matches the change: verified.
  • File packages/core/src/Lightbox/Lightbox.tsx: blocking finding in the fit check.
  • File packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: the fit sweep's oracle shares the end-edge assumption (part of the fix above).
  • File apps/storybook/stories/Lightbox.stories.tsx: clear.
  • File docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • File .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

The check compared the last line's end edge with the caption's, which
holds only for start-aligned text. It now compares the line's extent,
plus the toggle's place, with the caption's width, which holds for any
alignment and either direction.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b6c0e05

@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 shrink frame no longer forces a layout, and an end-aligned paragraph caption in the page lays out exactly as on main, but the fit check still misplaces "less" in two cases.

  • Miss: placeFitsBesideLastLine returns "fits" whenever place instanceof HTMLElement is false (Lightbox.tsx:196), which it always is for an element in a Picture-in-Picture window's document, so a caption opened at 360 px and widened to 392 px there wraps its last word beside "less", and an end-aligned caption gets "less" drawn over that word; isHTMLElement from utils/nodeType.ts, or view.HTMLElement as line 888 uses, restores the measurement.
  • Miss: the check takes the lowest text-node line as the caption's last line (Lightbox.tsx:207-216), so a caption whose last line is an inline image keeps "less" on an extra line after widening from 360 px to 391–393 px, where main ends the image's line with it; measuring image, SVG and inline-block boxes too keeps it on the flow's last line.

The fit sweep skips widths where the text keeps all its lines and reads text nodes only (LightboxPaging.interaction.browser.spec.ts:2185-2235), so it cannot catch either case; the pins for these fixes need an oracle independent of the check. The block-element and alignment fixes from the earlier rounds are in place.

Claims and files checked
  • Claim: an open caption that widens to fewer lines no longer forces a layout in the frame that shrinks it (title, changeset): verified; the frame callback only commits the count (Lightbox.tsx:1054-1063), where main read clientHeight after its write.
  • Claim: the old frame read after its write to learn whether "less" still fits: verified in main's code.
  • Claim: the delivery picks the count, and the frame commits it with flushSync and reads nothing after: verified (Lightbox.tsx:1043-1063).
  • Claim: with more extra lines, the next delivery corrects the count: verified in the code path and by widths that drop two lines laying out as on main.
  • Claim: the fit check reads only the text nodes' lines and compares the last line's width plus the place's with the caption's width, for any alignment: verified in the code (Lightbox.tsx:188-234); an end-aligned paragraph caption matches main at every width from 362 to 560 px.
  • Claim: nothing a person sees changes: false for a caption whose last line is an inline image and for any caption in a Picture-in-Picture window (findings above).
  • Claim: a "more" tap keeps its one forced layout, now recorded and pinned by a test: the tap handler is unchanged and the record line and verification cell are added; the trace case was not rerun here.
  • Claim: the tap, the clamped caption and paging are unchanged: verified in the diff.
  • Claim: the new frame cases fail before the change and pass with it, in Chromium and WebKit: not rerun here; the frame callback no longer reads anything after its write.
  • Claim: the fit cases fail where "less" is misplaced and pass here and on main: not rerun here; their oracle cannot see a wrong "fits" (note above).
  • Claim: two fixture stories pass the long caption as a paragraph, one centred, tagged no-visual and !autodocs: verified.
  • Claim: core typecheck, strict lint on the changed files, and the knowledge and changeset checks pass; the Lightbox unit files pass: verified (175 of 175); the wider unit, interaction and accessibility totals and the pre-review script were not rerun.
  • Claim: +424/−9 lines with the stated split: verified.
  • Claim: the merge of main keeps this pull request's own changes and brings the scoping of the Lightbox keyboard and viewport accessibility specs: verified.
  • Claim: the record line carries no narration, research, status or change references: verified.
  • Claim: no public or internal API change: verified; the API surface comparison lists no rows, and no module or data attribute is added.
  • Changeset: a @astryxdesign/core patch whose fix line matches the change: verified.
  • File packages/core/src/Lightbox/Lightbox.tsx: two blocking findings in the fit check.
  • File packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: non-blocking; the fit sweep's oracle cannot catch a wrong "fits".
  • File apps/storybook/stories/Lightbox.stories.tsx: clear.
  • File docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • File .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Lightbox/Lightbox.tsx Resolved
A caption in another window's document, as in a Picture-in-Picture
window, has elements that are not this window's. A new fixture story
puts the gallery with captions in a same-origin iframe that fills the
page, and the fit sweep now also runs there. At every width the sweep
also checks that "less" sits on the line its place keeps clear: a
wrong "fits" leaves the place a line above "less".

@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.

The frame that shrinks an open caption after the window widens now writes without reading layout, and captions the check does not model keep main's single read. The latest merge of main composes cleanly with the new wide-image caption path, and "less" sits exactly where it does on main. One optional comment-style suggestion from the last review is still open inline.

Claims and files checked

Review mode: full; reason: merge-touches-pr-files

  • An open caption that widens to fewer lines no longer forces a layout in the frame that shrinks it: verified; the frame-read cases record a clientHeight read after the write on main's code and none here, for plain, paragraph and centred captions.
  • That holds for text, inline elements, inline-blocks, images and plain blocks, and everything else (floats, drop caps, flex, grid and clipped blocks, empty inline-blocks, room under the last line, list markers, text indents, justified last lines, offsets, transforms, other writing modes, a block's generated content) keeps the one read: verified in placeFitsBesideLastLine, and the three unmodeled frame cases record exactly one read; markers, indents and block generated content keep it only where they reach the last line, so the list is conservative.
  • Where "less" sits does not change: verified; 30 fit sweeps pass here and on main's code, and main and this head give identical toggle positions and caption heights at 46 widths for three captions, with pixel-identical frames at five widened widths.
  • A "more" tap keeps exactly one forced layout, now in the record and pinned by a trace case: verified; both tap cases count one layout here and on main's code.
  • The resize delivery picks the count, the frame commits it with flushSync, and a widening by more lines is corrected by the next delivery: verified in the code.
  • The tap, the clamped caption and paging are unchanged: verified in the diff.
  • Twenty-seven fixture stories, all tagged no-visual and !autodocs, two right-to-left cases, and the flex-row and clipped-block captions coming from main with their own sweep: verified.
  • The record's new current-state line and FR1 verification cell name the layout count, with no narration or project status: verified.
  • Core typecheck, strict lint on the changed files, and the knowledge and changeset checks pass: verified.
  • The Lightbox interaction specs pass 194 with 4 skips in Chromium: verified; the WebKit count was not rerun.
  • +1617/−40 lines with the stated split: verified.
  • No public or internal API change: verified; the API generator reports no rows for Build, Core or the themes.
  • The latest merge of main drops this pull request's copies of the two captions main now carries, renames its sweep list, and reuses the text-line count main now reads earlier: verified.
  • Red-first results at intermediate commits, the WebKit legs, the 100-run counts, the unit and accessibility totals, the bundle-size numbers and the pre-review script: not rerun.
  • packages/core/src/Lightbox/Lightbox.tsx: clear; one optional comment-style suggestion still open inline.
  • packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: clear.
  • apps/storybook/stories/Lightbox.stories.tsx: clear.
  • docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

@cixzhang cixzhang removed the needs:design-review Affects visuals — Design should review label Nov 14, 2026
@vjeux
vjeux marked this pull request as ready for review November 15, 2026 02:15
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 15, 2026
@vjeux
vjeux marked this pull request as draft November 15, 2026 02:42
The caption-fit sweep took 41-57 s an instance in CI's WebKit leg, so
its 30 instances outran the leg's 15 minutes. Two changes:

- Both caption sweeps turn the backdrop's blur off, as a drag to
  dismiss does. With the blur on, each frame that resizes the page
  costs WebKit about 105 ms; with it off, about 27 ms. Caption layout
  does not read it.
- WebKit sweeps five shapes: plain text in each direction, a drop cap,
  generated words and bottom padding. Chromium sweeps all 30.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec b10309c

@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.

The frame that shrinks an open caption after the window widens still writes without reading layout, and captions the check does not model keep main's single read. The new commit changes only the interaction spec: the caption sweeps turn off the paint-only backdrop blur, and WebKit runs five of the thirty sweep shapes. One optional comment-style suggestion is still open inline.

Claims and files checked

Review mode: incremental; reason: none

  • An open caption that widens to fewer lines no longer forces a layout in the frame that shrinks it, for text, inline elements, inline-blocks, images and plain blocks: verified; the frame-read cases record no read after the write for plain, paragraph and centred captions at this head.
  • Every other layout (floats, drop caps, flex, grid and clipped blocks, empty inline-blocks, offsets, transforms, other writing modes, room under the last line, list markers, text indents, justified last lines, a block's generated content) keeps the one read: verified in placeFitsBesideLastLine, and the three unmodeled frame cases record exactly one read; markers, indents and block generated content keep it only where they reach the last line, so the list is conservative.
  • Where "less" sits does not change: verified; all 32 caption fit sweeps pass in Chromium at this head.
  • A "more" tap keeps exactly one forced layout, now in the record and pinned by a trace case: verified; both tap cases count one layout.
  • The resize delivery picks the count, the frame commits it with flushSync, and a widening by more lines is corrected by the next delivery: verified in the code.
  • The tap, the clamped caption and paging are unchanged: verified in the diff.
  • Twenty-seven fixture stories, all tagged no-visual and !autodocs, two right-to-left cases, and the flex-row and clipped-block captions coming from main with their own sweep: verified.
  • WebKit sweeps five of the thirty shapes (plain text in each direction, a drop cap, generated words, bottom padding) and Chromium all thirty: verified in the spec's case list and skip.
  • Both caption sweeps turn the backdrop blur off as a drag to dismiss does, and caption layout does not read it: verified; the sweep sets the same custom property the drag sets, which only feeds the backdrop's blur.
  • The record's new current-state line and FR1 verification cell name the layout count, with no narration or project status: verified.
  • Core typecheck, strict lint on the changed files, and the knowledge and changeset checks pass: verified.
  • The Lightbox interaction specs pass 194 with 4 skips in Chromium: verified; the WebKit count was not rerun.
  • +1646/−40 lines with the stated split, and +1617/−40 for the stated earlier range: verified.
  • No public or internal API change: verified; the API generator reports no rows for Build, Core or the themes.
  • The latest merge of main keeps the pull request's own changes and brings in only main's commits: verified; the merged commits change none of this pull request's files.
  • Red-first results at earlier commits, the WebKit timings, leg plan and counts, the 100-run counts, the unit and accessibility totals, the bundle-size numbers, the patch-id figures for earlier merges and the pre-review script: not rerun.
  • Changed rule, incremental re-review scope: checked: both recipes and the change since the last review (two changed rules, one test-only commit), no finding.
  • Changed rule, review mode line reasons: checked: this review's mode, no finding.
  • packages/core/src/Lightbox/Lightbox.tsx: clear; one optional comment-style suggestion still open inline.
  • packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: clear.
  • apps/storybook/stories/Lightbox.stories.tsx: clear.
  • docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

Besides its shapes, WebKit now sweeps a caption ending in a bottom
rule, two line breaks, an empty inline-block and an image. Where these
place "less" depends on how the engine lays out the last line, which is
where WebKit and Chromium differ. With bottom padding, WebKit covers one
ending of each kind the fit rules tell apart.

With all nine, the second WebKit leg would take about 12.6 minutes in
CI. So plain text left to right runs in Chromium only, while its mirror
stays. Each of the new endings follows plain text left to right. WebKit
sweeps eight of the 30 shapes, and Chromium sweeps all 30.
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec 4a9176b

@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.

The frame that shrinks an open caption after the window widens still writes without reading layout, and captions the check does not model keep main's single read. The new commit changes only the interaction spec: WebKit now sweeps eight of the thirty caption shapes, adding the image, bottom-rule, two-line-break and empty inline-block endings, while Chromium still sweeps all thirty. One optional comment-style suggestion is still open inline.

Claims and files checked

Review mode: incremental; reason: none

  • An open caption that widens to fewer lines no longer forces a layout in the frame that shrinks it, for text, inline elements, inline-blocks, images and plain blocks: verified; the frame-read cases record no read after the write for plain, paragraph and centred captions.
  • Every other layout (floats, drop caps, flex, grid and clipped blocks, empty inline-blocks, offsets, transforms, other writing modes, room under the last line, list markers, text indents, justified last lines, generated content outside inline elements) keeps the one read: verified in the fit check, and the three unmodeled frame cases record exactly one read; markers, indents and block generated content keep it only where they reach the last line, so the list is conservative.
  • Where "less" sits does not change: verified; all 32 caption fit sweeps pass in Chromium.
  • A "more" tap keeps exactly one forced layout, now in the record and pinned by a trace case: verified; both tap cases count one layout.
  • The resize delivery picks the count, the frame commits it with flushSync, and a widening by more lines is corrected by the next delivery: verified in the code.
  • The tap, the clamped caption and paging are unchanged: verified in the diff.
  • Twenty-seven fixture stories, all tagged no-visual and !autodocs, two right-to-left cases, and the flex-row and clipped-block captions coming from main with their own sweep: verified.
  • WebKit sweeps eight of the thirty shapes (plain text right to left, a drop cap, generated words, and the bottom-padding, bottom-rule, two-line-break, empty inline-block and image endings), plain left-to-right text runs in Chromium only, and Chromium sweeps all thirty: verified in the case list and the skip.
  • Both caption sweeps turn the backdrop blur off as a drag to dismiss does, and caption layout does not read it: verified; the sweeps set the same custom property the drag sets, which only feeds the backdrop's blur.
  • The record's new current-state line and FR1 verification cell name the layout count, with no narration or project status: verified.
  • Core typecheck, strict lint on the changed files, and the knowledge and changeset checks pass: verified.
  • The Lightbox interaction specs pass 194 with 4 skips in Chromium: verified; the WebKit count was not rerun.
  • +1649/−40 lines with the stated split, and +1617/−40 for the stated earlier range: verified.
  • No public or internal API change: verified; the API generator reports no rows for Build, Core or the themes.
  • Red-first results at earlier commits, the WebKit timings, leg plan and per-instance times, the 100-run counts, the unit and accessibility totals, the bundle-size numbers, the patch-id figures for earlier merges and the pre-review script: not rerun.
  • packages/core/src/Lightbox/Lightbox.tsx: clear; one optional comment-style suggestion still open inline.
  • packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: clear.
  • apps/storybook/stories/Lightbox.stories.tsx: clear.
  • docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 18, 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.

Approved pending CI: CI has not run on this head yet.

The frame that shrinks an open caption after the window widens still writes without reading layout, and captions the check does not model keep main's single read. This head only merges main: the pull request's own changes are unchanged, nothing the merge brings into Lightbox's imports touches the caption's measurement, and the Lightbox paging interaction spec passes in Chromium here, all 32 caption fit sweeps included. One optional comment-style suggestion is still open inline.

Claims and files checked

Review mode: incremental; reason: none

  • changed rules (1): Whatever the scope, these are computed over the whole pull request: checked the two review configurations and this review's mode decision, no finding.
  • An open caption that widens to fewer lines no longer forces a layout in the frame that shrinks it, for text, inline elements, inline-blocks, images and plain blocks: verified; the frame-read cases record no read after the write for plain, paragraph and centred captions at this head.
  • Every other layout (floats, drop caps, flex, grid and clipped blocks, empty inline-blocks, offsets, transforms, other writing modes, room under the last line, list markers, text indents, justified last lines, generated content outside inline elements) keeps the one read: verified in the fit check, and the three unmodeled frame cases record exactly one read; markers, indents and block generated content keep it only where they reach the last line, so the list is conservative.
  • Where "less" sits does not change: verified; all 32 caption fit sweeps pass in Chromium at this head, and the widened plain caption renders pixel-identically to main at 380, 392, 404 and 418 px.
  • A "more" tap keeps exactly one forced layout, now in the record and pinned by a trace case: verified; both tap cases count one layout.
  • The resize delivery picks the count, the frame commits it with flushSync, and a widening by more lines is corrected by the next delivery: verified in the code.
  • The tap, the clamped caption and paging are unchanged: verified in the diff; the paging interaction spec passes 73 of 73 in Chromium.
  • Twenty-seven fixture stories, all tagged no-visual and !autodocs, two right-to-left cases, and the flex-row and clipped-block captions coming from main with their own sweep: verified.
  • WebKit sweeps eight of the thirty shapes and Chromium all thirty: verified in the case list and the skip; the WebKit run itself was not repeated.
  • Both caption sweeps turn the backdrop blur off as a drag to dismiss does, and caption layout does not read it: verified.
  • The record's new current-state line and FR1 verification cell name the layout count, with no narration or project status: verified.
  • Core typecheck and the knowledge and changeset checks pass: verified at this head; strict lint was not rerun.
  • +1649/−40 lines with the stated split: verified; unchanged at this head.
  • No public or internal API change: verified; the API generator reports no rows for Build, Core or the themes.
  • The merges of main keep the pull request's own lines: verified for this head's merge, whose own diff is byte-identical; the figures stated for earlier merges were not rerun.
  • Red-first results at earlier commits, the WebKit timings, leg plan and per-instance times, the 100-run counts, the 194-test and other unit and accessibility totals, the bundle-size numbers and the pre-review script: not rerun.
  • packages/core/src/Lightbox/Lightbox.tsx: clear; one optional comment-style suggestion still open inline.
  • packages/core/src/Lightbox/__tests__/LightboxPaging.interaction.browser.spec.ts: clear.
  • apps/storybook/stories/Lightbox.stories.tsx: clear.
  • docs/specs/components/Lightbox/Lightbox.spec.md: clear.
  • .changeset/lightbox-caption-shrink-layout.md: clear.

Automated review (maintainer link)

@vjeux
vjeux marked this pull request as ready for review November 18, 2026 13:25
@cixzhang

Copy link
Copy Markdown
Contributor

/approve-spec f97cc5b

@cixzhang
cixzhang merged commit 0ee0913 into meta:main Nov 18, 2026
149 checks passed
@vjeux
vjeux deleted the fix/lightbox-caption-shrink-layout branch November 18, 2026 14:14

This branch was successfully deployed

1 active deployment
Preview — f97cc5be Deployed Nov 18, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants