feat(web): open pull request images in a gallery - #8990
Conversation
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b32c839. Configure here.
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR adds a production pull-request image gallery with modal state, document-wide image collection, keyboard navigation, and shared dialog behavior changes. The capability changes existing image interactions across multiple web components and is broader than a small isolated adjustment. Not approved because:
Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more. |
…mage-overlay # Conflicts: # apps/web/src/components/ChatMarkdown.tsx # apps/web/src/components/chat/ExpandedImageDialog.tsx # apps/web/src/components/chat/ExpandedImagePreview.tsx # apps/web/src/components/pullRequest/PullRequestMarkdown.tsx
|
Superseded by #10625 (merged) — markdown images in chat and PR bodies now open as navigable galleries on main. |
Pull request screenshots were static in T3 Code, so inspecting one required leaving the app or opening the asset separately. The existing expanded-image preview also received only one image at a time, which meant it could not navigate a pull request's image set.
This marks standalone markdown images as expandable, lets the pull request renderer derive an ordered gallery from the images that actually rendered, and reuses the existing expanded preview for navigation. Linked images remain links. The gallery uses each image's resolved
currentSrc, opens at the clicked image, wraps at both ends, and supports the existing buttons, arrow keys, and Escape behavior.Evidence
Verification
vp test runon the six affected markdown and expanded-image test files: 92 tests passedvp run --filter @t3tools/web typecheckgit diff --check upstream/main...HEADBuilt with GPT-5.6-SOL in the Codex harness through T3 Code.
Note
Open pull request images in a gallery view
buildExpandedImagePreviewFromElementsandbuildExpandedImagePreviewFromContainerto collect all marked images in a container and build a gallery, selecting the clicked image by DOM element identity rather than source URLPullRequestMarkdownto renderExpandedImageDialogwith the full gallery when an expandable image is clicked, falling back to the single-image preview when container aggregation is unavailableMarkdownMediaExpandHandler, which receives both the preview item and the renderedHTMLImageElement; images are marked withdata-expanded-imageand registered in aWeakMapfor gallery discoveryExpandedImageDialogkeyboard handling to use event capture and guardscreatePortalfor environments withoutdocumentMarkdownMediaExpandHandlerreplaces the previous single-preview callback type; any out-of-tree consumers of the old callback signature inChatMarkdown,ChatMarkdownVideo, or the asset-backed media renderer must update their prop types📊 Macroscope summarized d613b08. 4 files reviewed, 1 issue evaluated, 1 issue filtered, 0 comments posted
🗂️ Filtered Issues
apps/web/src/components/pullRequest/PullRequestMarkdown.tsx — 0 comments posted, 1 evaluated, 1 filtered
expandedImageStateis only hidden whentextchanges, not cleared. If a user has a gallery open for body A, the component receives body B (which unmounts the dialog), and then later receives the exact text A again, line 42 revives the old preview without another image click. This can happen while switching/reloading pull-request content and unexpectedly reopens a modal with stale gallery metadata. [ Already posted ]Note
Low Risk
UI-only markdown preview changes;
onImageExpandgains an optional second argument, which remains compatible for handlers that only use the preview object.Overview
Pull request bodies can now open standalone markdown images in the existing full-screen preview and step through every expandable image in that PR view, instead of previewing a single image in isolation.
Gallery discovery: Expandable images get
data-expanded-image, register preview metadata on mount, andonImageExpandnow receives the clickedHTMLImageElementsoPullRequestMarkdowncan collect all marked images in document order (usingcurrentSrc, alt fallbacks, and registered actions) and open the dialog at the right index, with a single-image fallback when gallery construction fails.Dialog behavior:
ExpandedImageDialogregisters arrow/Escape handlers in the capture phase and portals todocument.bodyonly whendocumentexists.Tests: New unit coverage for
buildExpandedImagePreviewFromElements(ordering, duplicatesrc, registered actions, invalid selection).Reviewed by Cursor Bugbot for commit d613b08. Bugbot is set up for automated code reviews on this repo. Configure here.