Repository navigation
fix(Lightbox): an open caption shrinks without a forced layout - #11539
Conversation
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.
|
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 |
|---|---|---|---|
| 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.
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
|
/approve-spec 67e9f39 |
There was a problem hiding this comment.
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
clientHeightread 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.
| - **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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
/approve-spec 0d5177a |
There was a problem hiding this comment.
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
clientHeightread 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-visualand!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.
|
/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.
There was a problem hiding this comment.
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
clientHeightafter 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-visualand!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/corepatch 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.
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.
|
/approve-spec b6c0e05 |
There was a problem hiding this comment.
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:
placeFitsBesideLastLinereturns "fits" wheneverplace instanceof HTMLElementis 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;isHTMLElementfromutils/nodeType.ts, orview.HTMLElementas 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 readclientHeightafter 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
flushSyncand 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-visualand!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/corepatch 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.
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".
There was a problem hiding this comment.
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
clientHeightread 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-visualand!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.
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.
|
/approve-spec b10309c |
There was a problem hiding this comment.
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-visualand!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.
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.
|
/approve-spec 4a9176b |
There was a problem hiding this comment.
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-visualand!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.
There was a problem hiding this comment.
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-visualand!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.
|
/approve-spec f97cc5b |






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
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
measureCaptionLinespicks the smaller count in its delivery. When the caption shows one line more than its text,placeFitsBesideLastLinechecks 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.flushSync.Evidence
clientHeightafter a write, in both engines.Scope
Components: Lightbox
Testing
clientHeightread. It passes here, for plain, paragraph and centred captions. For a paragraph with its own::afterwords, it expects exactly oneclientHeightread, 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.GalleryWithParagraphCaptionFixtureandGalleryWithCenteredParagraphCaptionFixturestories pass the long caption as a<p>, the second one centred.GalleryWithCaptionsInFrameFixtureshows the gallery with captions in a same-origin iframe that fills the page.GalleryWithImageCaptionFixtureends the long caption with an inline icon.GalleryWithBlockImageCaptionFixtureends it with a plain icon, which the reset makes a block.GalleryWithPaddedEndCaptionFixtureandGalleryWithMarginEndCaptionFixtureend it in end padding and an end border, and in an end margin.GalleryWithGeneratedContentCaptionFixtureandGalleryWithInlineBlockCaptionFixtureend it in generated content and in an inline-block element.GalleryWithVisuallyHiddenCaptionFixtureends it in absolutely positioned, clipped text, as a screen-reader-only class lays it out.GalleryWithParagraphGlyphCaptionFixtureandGalleryWithParagraphWordsCaptionFixturepass it as a paragraph whose own::afteradds a glyph, or words.GalleryWithPaddedParagraphCaptionFixturepasses it as a paragraph with 64 px start padding.GalleryWithEndAlignedParagraphCaptionFixturepasses it as one aligned to its end, ending in end padding and an end border.GalleryWithClippedChipCaptionFixtureends 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.GalleryWithInlineWordsCaptionFixtureends it in an inline element whose own::afteradds words.GalleryWithContentsWordsCaptionFixturewraps it in adisplay: contentselement that does the same.GalleryWithFloatCaptionFixture,GalleryWithInsideMarkerCaptionFixtureandGalleryWithIndentedParagraphCaptionFixturepass two blocks. The last block's first line starts with a 64 px float, an inside marker, or a 64 px indent.GalleryWithDropCapCaptionFixturepasses two blocks too; the last one starts with a floated first letter two lines tall.GalleryWithJustifiedLastLineCaptionFixturepasses it as a paragraph with its last line justified.GalleryWithOffsetEndCaptionFixtureends it in an element moved 48 px by a relative offset.GalleryWithBottomPaddedParagraphCaptionFixtureandGalleryWithBottomRuleParagraphCaptionFixturepass it as a paragraph with 16 px bottom padding, the second with a bottom rule.GalleryWithTrailingBreakCaptionFixtureandGalleryWithTrailingEmptyInlineBlockCaptionFixtureend 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 taggedno-visualand!autodocs. The captions ending in a flex row and in a block that clips its overflow come from main, with their sweep.::afterwords. Here it passes 100 of 100 runs for each caption. Trace marks now bound its window. Chromium coarsensperformance.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.tscis clean, and strict ESLint has no warnings on the changed spec.pnpm check:knowledgeandcheck:changesetspass. 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:prereports 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
LightboxPaginglayout count, not a pull request.Public and internal API delta
None. No export, prop, type, default, hook, module or data attribute changes.
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
b7d4c8afadshows.Link.tsxLightbox imports, and fix(Icon): preserve the nearest theme for icon resolution #11498 and fix(Icon): keep malformed slot diagnostics from interrupting rendering #11502, whose Icon files it reaches throughIcon/index.ts. It also brings docs(storybook): seven gallery stories use bundled sample images instead of picsum.photos #11614, which moves these stories and specs to bundled sample images.pressFeedback.tsLightbox reaches throughLink.tsx. It reaches feat(core): swipe actions come from createSwipe on the shared drag path #8690's newpressHeld.stylex.tsthroughpressFeedback.ts. feat(core): swipe actions come from createSwipe on the shared drag path #8690 also changes an accessibility spec that runs for every pull request.