Repository navigation
feat(Lightbox): drag a photo down to close, like Photos - #8215
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| Lightbox · Storybook | 119.3 kB (+1.5 kB) · 10.5 kB CSS (+71 B) | 3,374 (+397) | ✓ · ✓ · ✓ |
| lab/CommentThread | 331.5 kB (+1.4 kB) · 2.4 kB CSS (0) | — | — · — · — |
| lab/Comments | 338.4 kB (+1.4 kB) · 2.5 kB CSS (0) | — | — · — · — |
Package size: @astryxdesign/core 7.00 MB packed (+10.8 kB); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 29 rows, core 35 rows; run pnpm api:report.
Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's decision: drag to dismiss is new Lightbox behavior with no current spec, and it relies on the draft spec:AST-094 this stack adds, whose FR4, FR11 and FR14 also amend current records. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (you may do so yourself as an engineering owner), or says which requirement to change. Independently of that decision, these need fixing before approval:
- Land the earlier PRs of the stack and rebase, so this PR carries only its own commit rather than 32,471 authored lines.
- Restore every page the dismissal faded when the viewer reopens, since reopening a gallery at the item next to the dismissed one currently leaves the current page at
opacity: 0(Lightbox.tsxL684–688). - Restore the viewer when the caller keeps
isOpentrue after a drag dismissal, instead of leaving an open, invisible dialog. - Give the
data-lightbox-chromelayers azIndexso Close and Previous stay above a gallery's pages while the layers fade.
[Automated review]
e620a7e to
2a31746
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision: drag to dismiss is new Lightbox behavior with no current spec, and it relies on the draft spec:AST-094 this stack adds, whose FR4, FR11 and FR14 also amend current records. An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or names the requirement to change. Independently of that decision, these need fixing before approval:
- Land the earlier PRs of the stack and rebase, so this PR carries only its own commit rather than 32,892 authored lines; the rebase also clears
pr-a11y, which fails only because a spec it runs exists onmainbut not on this branch. - Restore every page and caption the dismissal faded when the viewer reopens, since reopening a gallery at the item next to the dismissed one leaves the current page at
opacity: 0(Lightbox.tsxL684–688). - Restore the viewer when the caller keeps
isOpentrue after a drag dismissal, instead of leaving an open, invisible dialog. - Give the
data-lightbox-chromelayers azIndex, so Close and Previous stay above a gallery's pages while the layers fade and for the half second after.
[Automated review]
2a31746 to
13266ce
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision: drag to dismiss is new Lightbox behavior with no current spec, and it relies on the draft spec:AST-094 this stack adds, whose FR4, FR11 and FR14 also amend current records (and FR4, as written, rules out the theme-retunable touch springs the stack ships). An engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request (the author may do so as an engineering owner), or names the requirement to change. Independently of that decision, these need fixing before approval:
- Land the earlier PRs of the stack and rebase, so this PR carries only its own commit rather than 37,202 authored lines.
- Restore every page and caption the dismissal faded when the viewer reopens, since reopening a gallery at the item next to the dismissed one leaves the current page at
opacity: 0(Lightbox.tsxL681–694). - Restore the viewer when the caller keeps
isOpentrue after a drag dismissal, instead of leaving an open, invisible dialog. - Give the
data-lightbox-chromelayers azIndex, so Close and Previous stay above a gallery's pages while the layers fade and for the half second after. - Regenerate
packages/cli/test/__golden__/no-icon-set/docs-topics.json, whosemotiontopic skeleton no longer matches the motion docs, sotest-node (1/4)passes again.
[Automated review]
|
Posted by Cindy's agent on her behalf. Parts of this PR re-implement behavior that already exists, or is being specified, as a shared part of core. Converging keeps one implementation per behavior:
This is about where the behavior lives, not about the PR's intent. |
|
Agreed: one implementation.
|
13266ce to
e1a3389
Compare
|
Pushed in e1a3389: the dismissal's release and its cancel take the animator's default and pass |
e1a3389 to
c6329eb
Compare
|
/approve-spec 164ec07 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head because the pull request is a draft; marking it ready for review starts the run.
#8147
Approve, with no blocking findings.
#8148
Request changes:
.changeset/lightbox-every-pointer.mdat #8148's own head says a ctrl-wheel or a trackpad pinch now zooms a photo in every Lightbox, while the gestures attach only withhasZoom; move the "withhasZoom" wording that #8197 adds into #8148's own commit.
#8197
Approve, with no blocking findings.
#8215
Approve: the gallery counter, the drag-to-close docs and changeset, the release rule and the restore Effect are fixed, and the record changes have an engineering owner's approval at this head (two optional notes inline).
Whole stack
Pass; since a pull request lands only when it and every pull request below it are approved, #8215 waits on #8148's changeset fix.
[Automated review]
| isOpen: 'Whether the lightbox is open.', | ||
| onOpenChange: 'Callback when open state changes.', | ||
| onOpenChange: | ||
| 'Callback when open state changes (including a photo dragged down).', |
There was a problem hiding this comment.
Optional: the full descriptions at lines 72 and 193 now say the drag closes the viewer "on a phone or tablet"; this dense one could say the same, for example 'Callback when open state changes (including, on a phone or tablet, a photo dragged down).'.
| }); | ||
| }); | ||
|
|
||
| describe('Lightbox recognizers attach for every pointer (spec:AST-094 FR43)', () => { |
There was a problem hiding this comment.
Optional: this suite's first test proves the drag to dismiss does not attach under a fine pointer, so a name such as 'Lightbox drag to dismiss attaches only in the touch presentation' would match what it checks.
|
/approve-spec 164ec07 |
|
/approve-spec f5d36c6 |
There was a problem hiding this comment.
Changes requested: two one-line fixes in #8197 stand between this stack and approval; every record change carries an engineering owner's approval at its own head, and a pull request lands only when it and every pull request below it are approved.
#8197 — request changes
.changeset/pager-settle-tempo.mdsays a released page now follows the theme's tempo "in aCarouselwithhasSnap", buthasSnapset totruekeeps native scroll snap and only auseSnapPaging()value runs the pager, so write "in aCarouselwhosehasSnapis auseSnapPaging()value".
#8215 — approve
No blocking findings in the drag to close; approved pending CI.
Whole stack — fails
- The tempo changeset above ships with the stack's release notes.
spec:AST-094's FR45 verification row still ends "the pager's measured settle, which does not yet followtempoorcharacter, is a recorded implementation gap" while the rewritten FR4 paragraph says the settle followstempo, so drop "tempoor" from that row in #8197.
Both pull requests now conflict with main in LightboxFinePointer.a11y.browser.spec.ts, so rebase #8197 and then this one; CI has not run on this head yet, and a maintainer adds the ci:run label so it runs.
[Automated review]
|
/approve-spec 029e7ff |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, so a maintainer adds the ci:run label so it runs.
#8197 — approve. Touch gallery paging follows the current Lightbox spec (FR7), and the tempo release note now names a Carousel given hasSnap={useSnapPaging()}. No blocking findings.
#8215 — approve. On a phone or tablet a fitted photo dragged down follows the finger, shrinks, and closes the viewer or springs back, as the current Lightbox spec (FR8) and the touch-presentations spec (FR4, FR36–FR37) describe; a mouse, pen or trackpad keeps today's behaviour, and the spec text this pull request adds is approved for this head. No blocking findings.
Non-blocking:
- The dense
onOpenChangedescription inLightbox.doc.mjscould say "on a phone or tablet", as the full descriptions do. - The suite at
Lightbox.test.tsx:1672checks that the drag to close attaches only in the touch presentation; its name could say so.
Whole stack — passes: the earlier release-note and FR45 fixes are in, and both pull requests merge cleanly with main. A pull request lands only when it and every pull request below it are approved.
[Automated review]
|
/approve-spec 229e5c0 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, so a maintainer adds the ci:run label so it runs.
#8197: approve, with no blocking findings. Touch gallery paging and the pager's tempo-paced settle follow the Lightbox and touch-presentation specs, and its spec text is owner-approved for its head.
#8215: approve, with no blocking findings. The touch drag to close follows the Lightbox spec and the shared release rule, its spec text is owner-approved for this head, and a mouse, pen or trackpad where the primary pointer is fine behaves as on main.
Whole stack: passes. A pull request lands only when it and every pull request below it are approved.
[Automated review]
There was a problem hiding this comment.
Waiting on an engineering owner: #8215's record changes need an approval for this head before the stack can be approved; no code finding blocks either pull request.
#8197: approve, with no blocking findings. Touch gallery paging and the pager's tempo-paced settle follow the Lightbox and touch-presentation specs, and its spec text is owner-approved for its head. Before it lands, rebase it onto main: #10415 now conflicts in LightboxZoom.interaction.browser.spec.ts, and that busy zoom proof should keep #10415's tempo 5 (slowViewer(page, ZOOM_TEMPO)).
#8215: waits on an engineering owner's decision on its Lightbox record changes: the FR5 rewrite with the new Motion section listing the two measured dismissal springs, the Current-state line reporting the close about 0.3–0.5 s after the lift, and the drag's fade of the controls, caption and neighbouring photos with the backdrop's blur off while it moves. The approval given at the previous head does not carry over to this restack. An engineering owner records it by commenting /approve-spec followed by this head's full commit SHA, and the author may do so as an engineering owner. Its code is unchanged since the last review and has no blocking finding.
Whole stack: passes. A pull request lands only when it and every pull request below it are approved. CI has not run on this head; a maintainer adds the ci:run label so it runs.
[Automated review]
|
/approve-spec b540d43 |
There was a problem hiding this comment.
Approved: both pull requests in this stack approve, and CI passes on this head.
#8197: approve, with no blocking findings. Touch gallery paging and the pager's tempo-paced settle follow the Lightbox and touch-presentation specs, its spec text is approved by an engineering owner for its head, and the busy zoom proof now keeps main's tempo 5.
#8215: approve, with no blocking findings. The touch-only drag to close follows the Lightbox spec's release rule, and its record changes (the measured dismissal springs in the new Motion section and the late-close gap line) are now approved by an engineering owner for this head. Two optional wording nits stay open on the dense onOpenChange description and one test suite's name.
Whole stack: passes; it merges cleanly with today's main. A pull request lands only when it and every pull request below it are approved.
[Automated review]
|
/approve-spec b299095 |
There was a problem hiding this comment.
Approved: both pull requests in this stack approve, and CI passes on this head.
#8197: approve, with no blocking findings. Touch gallery paging and the pager's tempo-paced settle follow the Lightbox and touch-presentation specs, its spec text is approved by an engineering owner for its head, and its busy settle proof now treats a run the harness left out as missing.
#8215: approve, with no blocking findings. The touch-only drag to close follows the Lightbox spec's release rule, its record changes are approved by an engineering owner for this head, and its dismissal proofs now name the motion each hold judges. Two optional wording nits stay open on the dense onOpenChange description and one test suite's name.
Whole stack: passes; it merges cleanly with today's main. A pull request lands only when it and every pull request below it are approved.
[Automated review]
There was a problem hiding this comment.
Not yet: #8215 approves on its own, but #8197 below it changes two Lightbox behaviors that no spec settles, so the stack waits on an engineering owner.
#8197 — waits on an owner decision:
- Miss: a controlled or default
indexbelow 0 now opens the viewer on the first item, wheremainrenders nothing, and no Lightbox requirement settles that fallback. - Miss: in a gallery, a video one item away now stays mounted and paused, so paging back resumes it where it stopped instead of restarting it as on
main, and no requirement settles that either.
An engineering owner approves or changes these two behaviors by commenting /approve-spec with #8197's full head SHA on #8197, or by answering in a comment; the author may do so as an engineering owner.
#8215 — approve, with no blocking findings.
Whole stack — passes and merges cleanly with today's main; a pull request lands only when it and every pull request below it are approved.
[Automated review]
There was a problem hiding this comment.
Approved: both pull requests in this stack approve, and CI passes on this head.
#8197: approve, with no blocking findings. Touch gallery paging and the pager's tempo-paced settle follow the Lightbox and touch-presentation specs, and its record edits carry an engineering owner's approval for its head.
#8215: approve, with no blocking findings. The touch-only drag to close decides once at the lift through Core's shared release rule and plays the springs the Lightbox record lists, with an engineering owner's approval of the record edits for this head.
Whole stack: passes; the public API is unchanged and the head merges cleanly with main. A pull request lands only when it and every pull request below it are approved, so #8197 lands first.
[Automated review]
A Lightbox photo closed only through its Close button or a tap beside it. Dragged down, a fitted photo now follows the drag, shrinks, and the backdrop fades with it. The release closes the viewer when the drag's projected end lies more than 10 pt below its start, so a short flick closes and a drag brought back springs back. The photo leaves on Photos' measured dismissal springs, which component:Lightbox lists, as spec:AST-094 FR4 allows an exit. Every other release, the return included, plays springs.settle. The release animates on the compositor. The drag to close is part of the touch presentation, which a coarse primary pointer brings (spec:AST-094 FR13). Where the primary pointer is fine, a mouse's, a pen's or a trackpad's drag leaves the photo in place, as before. The backdrop's blur comes off while the photo moves and returns at rest, since a full-screen blur every frame drops frames on low-end phones. Under Reduce Motion the photo fades out. The close is reported when the photo has left the screen, about 0.3-0.5 s after the lift; component:Lightbox names that gap until the shared exit hold lands.
Main's holdAnimations now takes the motion a test judges, and rejects when the hold took none of it. Each dismissal proof names what it reads: the dismissal's travel, the spring back's scale, and the opacity of each Reduce Motion fade. A cancelled return names its travel, and its scale too where the test reads it: a photo brought back within 10 pt of the start returns with no scale to animate.
|
/approve-spec 340106c |
There was a problem hiding this comment.
Approved: the drag to close follows the Lightbox and touch-presentation specs, its record changes carry an engineering owner's approval for this head, and CI passes.
With #8197 merged, this pull request lands on its own; there are no blocking findings.
- Optional: the dense
onOpenChangedescription (Lightbox.doc.mjs:298) could say "on a phone or tablet", as the full descriptions do. - Optional: the suite at
Lightbox.test.tsx:1676checks that the drag attaches only in the touch presentation, which its name could say.
[Automated review]
|
/approve-spec 6ef4060 |
There was a problem hiding this comment.
Changes requested: the drag to close itself is settled on spec (an engineering owner's /approve-spec covers this head), but its WebKit busy-main-thread proof fails CI at this head.
- Miss:
LightboxDismiss.interaction.browser.spec.ts:412-473judges the dismissal's roughly 0.15 s motion in a single run, sopr-interaction-webkit (2/6)fails with "the compositor presented too little in this window to judge"; play the dismissal several times and judge the runs withpooledBusyProof, as the harness README andLightboxPaging.interaction.browser.spec.tsdo. - Miss:
screenSignal.tsre-implements the harness'strackBrightnessframe reader (regionSignal,signalFrames) and adds two helpers nothing calls (cadenceOutside,presentedFramesExpected); read the fade withtrackBrightnessand deletescreenSignal.tsand its test.
The other failing leg, pr-interaction (4/6), is LightboxZoom's double-tap busy proof, which this pull request does not change and which passes in WebKit here. Two optional wording nits from earlier still stand (Lightbox.doc.mjs:298 and the suite name at Lightbox.test.tsx:1737).
[Automated review]
The dismissal runs for about a fifth of a second, and a blocked WebKit presents a frame only every 100 to 300 ms, so one run could hold too few frames to judge. The proof now plays four dismissals and judges them with the harness's pooledBusyProof: each run against its own control, the frame floor over all of them. A run counts only with two control frames, and each judged run must show a new level on its own. It reads the backdrop's fade at a flat point with trackBrightness, so screenSignal.ts and its test, a second frame reader, are gone.
There was a problem hiding this comment.
Approved: the drag to close follows component:Lightbox FR8 and spec:AST-094, its record changes carry an engineering owner's approval for this head, both test findings from the last review are fixed, and CI passes on this head.
- The dismissal's busy-main-thread proof now plays four dismissals and judges them with
pooledBusyProof; it passes in the WebKit interaction leg that failed before, and in Chromium. screenSignal.tsand its test are gone; the proof reads the backdrop's fade with the harness'strackBrightness.
Two optional wording nits from earlier still stand (Lightbox.doc.mjs:298 and the suite name at Lightbox.test.tsx:1737). The Stack: line names #10630, but #10630 is built on an earlier commit of this pull request, so this one was reviewed on its own.
[Automated review]
|
/approve-spec 5773dc0 |
Batch: B7 Lightbox
Stack: #8215 → #10630
On main 88ba279, after #8197 merged; this head merges main 619ffeb with no conflict, vjeux@6ef4060. This head answers CodeBunny's 07:28Z review, vjeux@5773dc0: the dismissal's busy proof plays four dismissals and judges them with the harness's
pooledBusyProof, each run against its own control and the frame floor over the pool. It reads the backdrop's fade at a flat point withtrackBrightness, soscreenSignal.tsand its test are gone. This pull request carries only its own two commits, restacked from #8197's head with its own diff unchanged (the same patch-id): the drag to close, vjeux@ca38b12, and the dismissal proofs naming the motion each hold judges, vjeux@340106c. InuseZoomStage.ts, where #8197'shasOuterPageroption meets this pull request's drag to dismiss, the drag-to-close commit keeps both.This round rebases onto the stack's new heads and follows main's
spec:AST-094FR4 for the drag's two releases:springs.settlefrom the release velocity, with the backdrop and controls on its pace.springs.settle(response 0.5 s, critically damped). The dismissal is unchanged.resolveSnapPoint, with the same projection. Two edges follow its rules: a projection of exactly 10 pt while moving down dismisses, and a release above the drag's start moving down springs back, as a release moving back toward the start does.Why
On a phone, the only ways out of a Lightbox photo are a small Close button or a tap beside it. In Photos, people drag the photo down: it follows the finger, shrinks, the background fades, and letting go closes it, or brings it back if the drag returns.
What changes
spec:AST-094FR13). Where the primary pointer is fine, a mouse's, a pen's or a trackpad's drag leaves the photo in place, as on main.Record change
spec:AST-094FR4)."spec:AST-094FR4 and FR45.Writing rubric results
Run over
docs/specs/components/Lightbox/Lightbox.spec.md:spec:AST-094FR4 asks of a measured exit spring.How to check it
In the "Gallery with zoom" story, on a phone:
springs.settle, and the backdrop and controls return with it.Evidence
The pooled busy proof (
LightboxDismiss.interaction.browser.spec.ts, "the dismissal keeps changing the screen every frame while the main thread is blocked"), the five conditions:pooledBusyProofholds each judged run to its own control. A run whose backdrop holds while its control moves fails the pool by name: "run N: moved on X of the Y frames its control moved".minRunFrames: 2plus the per-run new-position check: a run whose control moved on fewer than two frames is "too little to judge" and leaves the pool. After the verdict, each judged run must show a new backdrop level on at least one of its own frames, not an excused one (movedWith − belowStep ≥ 1, "run N shows a new backdrop level"), so runs of one frame cannot add up to the floor. A pool of three moving runs and one whose two frames are both excused passes the verdict and fails this check (not for landing): vjeux@9e9635bminJudgedRuns: 2of 4: the helper's default, set explicitly. On failure it reports "N of 4 runs judged, under 2".springs.settle. The size is off by 0.0143 of scale against 0.002, and the position by 1.73 px and 3.45 px against 0.25 px. All four pass at this head.dismissCommits, the new unit case fails on the release above the start ("expected true to be false"); it passes throughresolveSnapPoint.Safari on the iOS 26.2 simulator, recorded with the previous return timing (the dismissal is unchanged):
Fine pointer, before and after (desktop Chromium, a mouse, "With zoom"; at rest, 120 px into a drag down, and 120 ms after the release): the drag to close is touch only, so a mouse drag leaves the photo in place and the viewer open on both.
main:
this pull request:
Testing
At 5773dc0: the dismissal's busy proof, pooled, in WebKit in a 4-CPU container (the CI profile) with two busy threads: the single run before it starves 4 of 8 runs, the pooled proof passes 4 of 4 (16 dismissals). In a 2-CPU container with none, the single run starves 8 of 8 and the pooled proof passes 4 of 4. With six busy threads the single run starves 12 of 12; the pooled proof passes 3 of 6 and fails the other 3 by name (too few runs judged, or a run's window under 100 ms). It passes in Chromium, loaded and idle, and in WebKit idle. Both mutants fail the pooled proof in both engines (not for landing): a dismissal the main thread drives, "moved on 0 of the 13 frames its control moved", vjeux@6f4f1ec; a frozen one, "4 began after the motion had settled", vjeux@4e40921. With
minRunFrames: 2and the per-run check at this head, it passes 2 of 2 in WebKit with two busy threads, 2 of 2 in a 2-CPU container and 1 of 1 in Chromium, and both mutants still fail the pooled proof in both engines; replayed, every recorded run keeps its verdict. The Lightbox unit files pass 146 of 146 andpnpm check:knowledgepasses.At 340106c on main 88ba279: core
tscis clean; the Lightbox, motion, Text and Layer unit files pass 1,739/1,739;pnpm check:knowledgepasses. In a 4-CPU container (the CI profile) the Lightbox interaction specs pass 102 in Chromium (4 skips) and 95 in WebKit (9 skips). On a loaded box, WebKit's two busy-main-thread proofs failed once each by name (the frame floor and touch pacing); alone they pass 6 of 6. The Lightbox a11y specs pass 28 of 28 in Chromium.At b299095 on #8197's 0bb42a8 and main 5c1b7d4: core
tscis clean, where 977e361 alone has the five errors #10438 brings. The Lightbox interaction specs pass 102 in Chromium (4 skips) and 96 in WebKit in a 4-CPU container, the CI profile (9 skips); the WebKit run's one failure, the dismissal's busy proof, passes 10 of 10 alone at this head and at b540d43. The two dismissal specs pass 78 of 78 in WebKit, three times over.At 029e7ff, the same own diff (patch-id unchanged) sits on #8197's 3ee5207, and it merges with main 1c142dc without conflict. At f5d36c6 on #8197's 22da53d (main bef866e):
pnpm install --frozen-lockfileexits 0; coretscis clean; the Lightbox, hooks, motion and gestures unit files pass 2,918/2,918;pnpm check:knowledgeandpnpm check:changesetspass.Earlier, at 164ec07 on #8197's 0fc7062 (main 1dce318); the browser runs used 86477e5, which differs only by two unit cases that pin the restore to the viewer's opening:
pnpm install --frozen-lockfileexits 0; coretscis clean; strict ESLint on every changed file 0; comment sentence lengths 0 over;pnpm check:knowledge,check:changesets,check:repo,check:i18n-catalog,check:i18n-runtime,check:use-clientandcheck:package-boundariespass;