fix(web): scrolling pans expanded images and Mermaid diagrams#26630

merged4
main
GitHub fork: issue-watch/26611
opened20d agobySshivam
View on GitHubTwo-way sync enabledPR last imported 7d ago

Problem

Plain scrolling in the expanded image viewer zoomed instead of moving the image, so a zoomed image or Mermaid diagram could not be panned with a trackpad or wheel.

Closes https://github.com/pingdotgg/t3code/issues/26611

Change

  • Only pinch and Ctrl+wheel zoom (both arrive as a ctrlKey wheel event).
  • Plain wheel scrolling, vertical, sideways or diagonal, now pans through the viewer's native scroll area.
  • Mouse users zoom with Ctrl+wheel, click, or +/-/0, as before.

Verification

Web dev server in Chromium with real wheel input, same test image, Mermaid diagram and steps on main c6ca605 and this head 56e699e. The top-left box is a capture-only overlay showing the viewer's zoom and scroll position.

After 4 wheel-down ticks: main is back at 100% with scroll y=0; this PR stays at 165% and has moved to y=415.

Image, before: watch the zoom. After Ctrl+wheel takes it to 165%, plain scrolling drops it back to 100% and the image never moves.

https://github.com/user-attachments/assets/e3a70f31-3262-42f2-92f4-163d421ea15f

Image, after: zoom stays at 165% while scroll x/y change and the view pans down, right, then up-left. Ctrl+wheel still zooms back to 100%.

https://github.com/user-attachments/assets/2ff6a48d-66bb-4d23-92eb-d69d204c9d6c

Mermaid, before and after: same steps on an expanded diagram, same result.

https://github.com/user-attachments/assets/a09a27f9-0210-4890-acf0-b5fc855f6f9e

https://github.com/user-attachments/assets/fd942145-75f0-402b-82ba-f8b851e64e14

The blue rounded outline appears only once Tab focuses the viewer, and looks the same on main and this PR (main's focus ring). Wheel-only use shows no outline on either.

  • The new browser test in ExpandedImageDialog.browser.test.tsx fails on main (plain wheel is cancelled) and passes here.
  • fleet-job check passed at 56e699e (format, lint, knip, typecheck, tests).
  • Not shown: physical Mac trackpad pinch and momentum scrolling. Earlier packaged macOS app recordings still apply; the viewer code hasn't changed since.

Implemented by Opus 5.5 in Claude Code; earlier review and macOS testing by gpt-6.1-sol in Codex.

Checks

22 successful · 16 skipped
All checks passed
bc839b9

Added 1 commit

  • fix(web): scrolling pans an expanded image instead of zooming it2d9b7ab
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — Ordinary scrolling now pans expanded images and Mermaid diagrams, while pinch or Ctrl+scroll zooms. A human should confirm this change to the viewer’s default scroll interaction.

No code changes detected at 56e699e. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

External image Run configuration

External image Commits

Reviewing files that changed from the base of the PR and between 56e699e76e4aa3ecae86d6ff86d48d70093268da and bc839b97aab81700d6459519437c8509d4c92f2e.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Ordinary wheel input now pans the image viewer without zooming. Ctrl+wheel zooms the image. The accessible description and browser test reflect these interactions.

Changes: Image viewer wheel interaction

Layer / File(s)Summary
Wheel interaction and regression coverage
apps/web/src/components/chat/ZoomableImage.tsx, apps/web/src/components/chat/ExpandedImageDialog.browser.test.tsx
The wheel handler zooms only for Ctrl+wheel and leaves ordinary wheel input available for panning. The accessible description identifies scrolling and dragging as pan controls. The browser test checks wheel cancellation, zoom, panning, and preservation of the image position under the viewport center during zoom.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related issues

  • pingdotgg/t3code#29740: This PR changes ordinary wheel input to pan at a fixed image scale. It does not address the issue’s fit-to-height calculation or maximum zoom behavior.

Possibly related PRs

Suggested reviewers: juliusmarminge, t3dotgg

Merge Risk: External image Minimal · previous review 56e69

Ordinary scrolling pans while Ctrl+scroll zooms in the reported checks. No concrete issue remains that should block merging.

Pre-merge checks: Passed 2 · Inconclusive 2

Failed Failed checks: 2 inconclusive

Check nameStatusExplanationResolution
Out of Scope Changes checkInconclusiveThe wheel changes in ZoomableImage.tsx and their regression test support [#26611] and stay in scope. The aria text update supports the new input model. Head 56e699e7 adds a separate change not des…Provide evidence that expanded Mermaid diagrams or the file-preview path render SVGs without width and height through ZoomableImage, and explain why the SVG fit change belongs in this PR. Alternatively, move the SVG fit change and its tes…
Description checkInconclusiveThe description states the problem, the change, and a detailed verification section with recordings, a regression test result, and unverified areas. It is thorough, but it does not link a triaged bug …Add a "Scope and approval" statement that points to the triaged issue #26611 and any maintainer approval comment on the direction and scope. If maintainer approval is not present, explain why this focused fix of an obvious bug qualifies wit…
Passed Passed checks: 2 passed

Check nameStatusExplanation
Title checkPassedThe title "fix(web): scrolling pans expanded images and Mermaid diagrams" names the main change. The changeset makes ordinary wheel input pan expanded images and Mermaid diagrams instead of zooming th…
Linked Issues checkPassed[#26611] requires that ordinary trackpad or wheel scrolling pan expanded images and Mermaid diagrams, and that pinch zoom still zooms. At head 56e699e7, ZoomableImage.tsx returns early from the vi…
Full details: Title check

Explanation

The title "fix(web): scrolling pans expanded images and Mermaid diagrams" names the main change. The changeset makes ordinary wheel input pan expanded images and Mermaid diagrams instead of zooming them, and reserves zoom for pinch and Ctrl+wheel. The title follows the conventional commit format the template recommends and is specific enough for a teammate scanning history.

Full details: Linked Issues check

Explanation

[#26611] requires that ordinary trackpad or wheel scrolling pan expanded images and Mermaid diagrams, and that pinch zoom still zooms. At head 56e699e7, ZoomableImage.tsx returns early from the viewport wheel listener unless event.ctrlKey is set. Pinch on macOS arrives as a ctrlKey wheel event, so pinch zoom stays active. Plain wheel events are no longer canceled, so the overflow-auto viewport scrolls natively. The Ctrl+wheel zoom factor is 0.01. ExpandedImageDialog.browser.test.tsx checks plain-wheel non-cancellation, fixed scale during vertical, horizontal and diagonal panning, and anchored Ctrl+wheel zoom. The change since the previous reviewed head 572de1e0 adds an SVG fit-size change (mimeType === "image/svg+xml" ? Infinity : 1) and a fit test. It does not alter wheel handling, so the wheel requirement assessment still holds. The source diff does not directly show that the expanded Mermaid view uses ZoomableImage. That link rests on the PR description and the before-Mermaid recording. Physical trackpad pinch and momentum are unverified. That gap is not a coding requirement failure.

Full details: Out of Scope Changes check

Explanation

The wheel changes in ZoomableImage.tsx and their regression test support [#26611] and stay in scope. The aria text update supports the new input model. Head 56e699e7 adds a separate change not described in the PR description: the fit scale for image/svg+xml becomes Infinity before the min() with width and height limits, plus the it.each test fits a markdown SVG without intrinsic size to the viewer. The commit comment says an SVG without width and height reports a tiny default size. The change alters initial fit and can upscale vector images. The PR description says the head 572de1e0 change does not alter the viewer implementation, so it does not cover this change. The issue does not mention SVG fit sizing. The diff does not show that expanded Mermaid diagrams reach this path without intrinsic size. The connection to #26611 is therefore unestablished. The change is not shown to be unrelated, because it sits in the same shared viewer used for expanded Mermaid diagrams.

Resolution

Provide evidence that expanded Mermaid diagrams or the file-preview path render SVGs without width and height through ZoomableImage, and explain why the SVG fit change belongs in this PR. Alternatively, move the SVG fit change and its test to a separate pull request. Update the PR description to cover commit 56e699e7.

Full details: Description check

Explanation

The description states the problem, the change, and a detailed verification section with recordings, a regression test result, and unverified areas. It is thorough, but it does not link a triaged bug issue or maintainer approval in the Scope and approval section. It does cite issue #26611 as closed by the PR, and the linked issue objectives describe the reported behavior. Because the template requires an explicit approval reference or justification for scope, that section is incomplete, which keeps the description from a clean pass.

Resolution

Add a "Scope and approval" statement that points to the triaged issue #26611 and any maintainer approval comment on the direction and scope. If maintainer approval is not present, explain why this focused fix of an obvious bug qualifies without prior approval. Also add the model and harness used for the work, as the template asks, and keep the Problem and Change sections in the template's expected form.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
External image Recent review info

External image Run configuration

External image Commits

Reviewing files that changed from the base of the PR and between 572de1e066a26bd3f16b8cf8b862f829da36ab73 and 56e699e76e4aa3ecae86d6ff86d48d70093268da.

External image Files selected for processing: 2

  • apps/web/src/components/chat/ExpandedImageDialog.browser.test.tsx
  • apps/web/src/components/chat/ZoomableImage.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

[gpt-6.1-sol][Codex] on behalf of shivam.

Before and after evidence for this PR. Generated test data only; macOS 27.0.1, Electron 44.9.3. Baseline 9e09926d97824179d97311d1a810c6b5bb60d2d1, fixed 2d9b7ab5b277953fdb589b467cb2a43e111bb798.

Before, image scrolling changes zoom:

https://github.com/user-attachments/assets/14849bdf-943c-4a6a-8d87-a2a8a584659d

Before, Mermaid scrolling changes zoom:

https://github.com/user-attachments/assets/d1e1fc9f-ecdc-4cf2-8ecf-b4f2b0bf575f

After, scrolling pans the image at a fixed zoom, followed by other zoom and pan controls:

https://github.com/user-attachments/assets/3040dafe-9650-4984-bd18-1fb9756ffc9c

After, scrolling pans the Mermaid diagram at a fixed zoom, followed by other zoom and pan controls:

https://github.com/user-attachments/assets/95ea65b3-d315-477d-b2ff-870793880fdd

Viewer captures use different zoom levels; the videos establish scale preservation during scrolling.

Added 1 commit

  • Merge remote-tracking branch 'github/main' into maria/takeover-original-26630572de1e

Note

Written by gpt-6.1-sol on behalf of Maria

thanks @shivamhwp. the native overflow panning and ctrl-wheel guard already provide the smallest correct fix, so i kept your implementation and regression test intact. merged current main (8970a32104e0) into your branch without rewriting history. head: 572de1e066a26bd3f16b8cf8b862f829da36ab73. the diff remains two files, with no unrelated changes.

verification:

  • reproduced the regression on current main: ordinary wheel was canceled; the existing regression failed there and both browser tests passed with the fix.
  • blacksmith vp run check:changed passed format, lint, both knip passes, affected typechecks, browser tests and react compiler checks.
  • real web client, system chrome: uploaded image and mermaid attachment expansion, vertical/horizontal panning, ctrl-wheel zoom, click zoom, keyboard reset and closing. an ordinary 180px wheel changed scrollTop by 180 while width stayed 2240px; main shrank that same image to 1563px. mermaid wheel panned 120px at unchanged width, then ctrl-wheel zoomed.
  • all 31 head checks are green; cafe reports mergeable. the latest bot review has no actionable findings.
  • two independent code reviews approved this head with no findings. uploaded recording playback and seeking passed.

unverified this run: physical trackpad pinch/momentum, packaged electron, native mobile and macos fullscreen spaces. the shared web/electron viewer changes; native mobile is unaffected. maintainer approval of the wheel behavior change remains for review.

matching image data and wheel input, before and after:

main: ordinary wheel changes image scale

fixed: ordinary wheel pans at unchanged image scale

main and fixed wheel interactions, ctrl-wheel zoom and keyboard reset

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified as-is at 572de1e066a26bd3f16b8cf8b862f829da36ab73 on this linux boat vm. no code changes or pushes.

  • reproduced on current github/main (616c426f5f) in ../main, installed with vp i, then stopped its captured dev process before starting the exact pr head. both used real dev servers and isolated state.
  • used repo playwright and /usr/bin/google-chrome, at 1440×1000. created a project pointing to a real git repo through the app. a real codex gpt-6.1-sol turn created the architecture image and mermaid response. preserved that app-created state for matching before/after data. a second real codex turn completed through the pr web client and confirmed the file dimensions. no replay provider, mock, fixture, or demo data.
  • ordinary vertical, horizontal, and diagonal wheel input pans both expanded markdown images and mermaid diagrams at unchanged scale on the pr. main changes scale on vertical and diagonal input.
  • nearby behavior passed: anchored ctrl+wheel zoom (image anchor drift below 0.001), drag panning, click zoom, keyboard plus/minus and 0 reset, arrow-key panning, escape, and the close button. the second provider response appeared in the client.
  • blacksmith ran the existing ExpandedImageDialog.browser.test.tsx: both tests passed. github currently reports 21 successful and 10 skipped checks, none failing or pending.

measured through the running client with the same initial zoom and wheel inputs:

text
1 main pr
2image, wheel y=180 width 2520 -> 1758.14 width 2520 -> 2520
3 scrollTop 525 -> 705
4image, wheel x=120 scrollLeft 646 -> 766
5image, wheel -40,-40 x 766 -> 726; y 705 -> 665
6mermaid, wheel y=180 width 1312.5 -> 915.69 width 1312.5 -> 1312.5
7 scrollTop 525 -> 705
8pr codex turn completed; client displayed:
9 "width: 1600px, height: 1200px."
10 "provider verification complete."

screenshots follow the identical 180px vertical wheel input. the recording shows main first, then the pr; each shows image followed by mermaid, with vertical/horizontal/diagonal wheel, ctrl+wheel, drag, reset, and click zoom. inspected the captures and watched the full exported recording. uploaded playback and seeking also passed in t3's browser.

main: ordinary image wheel input changes scale

pr: the same image wheel input pans at fixed scale

main: ordinary mermaid wheel input changes scale

pr: the same mermaid wheel input pans at fixed scale

main and pr: real image and mermaid wheel, zoom, drag, and reset interactions

Not verified

physical trackpad pinch and momentum, packaged electron, macos/windows behavior, native ios/android, remote/relay/tunnel connections, and separate file-preview entry points were not exercised on this linux web run. ctrl+wheel covers the zoom event path, not physical pinch hardware. the first codex turn's optional html preview tool timed out; it still completed and its actual image and mermaid rendered in the client. neither provider turn stalled for ten minutes.

maintainer approval of the default wheel interaction remains a review decision. no merge, close, rebase, force-push, or label changes.

[gpt-6.1-sol][Codex] on behalf of shivam.

Resolved R1, the missing packaged macOS Electron verification, at 572de1e066a26bd3f16b8cf8b862f829da36ab73.

Built an unsigned macOS arm64 ZIP on shiv with vp run dist:desktop:artifact --platform mac --target zip --arch arm64 --output-dir /tmp/test-pr/t3code-26611/artifacts --keep-stage --verbose. The command exited 0 and validated the app payload. The executed bundle reported app.isPackaged === true, embedded commit 572de1e066a2, a t3code://app/ renderer and its bundled server. No Vite server or development renderer ran. Environment: macOS 27.0.1 arm64, Electron 44.10.0, Chromium 152.0.7977.169. Run r_aczqohwzdkfb2q00.

Both viewers passed ordinary vertical, horizontal and diagonal scrolling at fixed zoom, followed by Ctrl+wheel zoom in and out. Representative measurements from trusted CDP wheel input:

ViewerOrdinary wheel resultWidth during all three pan gesturesCtrl+wheel zoom-in width
ImageY +180, X +120, then X/Y -402483.4375 px unchanged3524.1719 px
MermaidY +180, X +120, then X/Y -402175.0156 px unchanged3086.4844 px

Each clip shows expansion, Ctrl+wheel zoom, all three ordinary pan gestures, and further Ctrl+wheel zoom. I inspected the extracted frames and the successful numeric test output.

Packaged image:

https://github.com/user-attachments/assets/39bd18ec-0348-423d-b677-5d94e94873f1

Packaged Mermaid:

https://github.com/user-attachments/assets/c6fe943d-9b35-43be-a4bf-f4dc7a4844e7

Frames from the exported image and Mermaid recordings:

The app used isolated HOME, T3 home and Electron profile from its first launch, with generated image and Mermaid data. It did not access live app state or sign in to T3 Connect. To preserve background control, test-only in-memory hooks made window presentation inactive and disabled focus requests; viewer files, layout and input handlers were unchanged. A readout-only overlay showed the measurements. Input was trusted Chromium CDP wheel automation, not physical trackpad input.

Build provenance: SHA-256 of app.asar was a4662a1e8ccd1adf6f8358a771faeb53b092e28165c3b29161ac8a96cd25b597; packaged ZIP was b19a8fbc957679320ab977e3e4cb7b25abaeebe255384b8ae3c0beb5b579abd1. Both final MP4s decoded without errors. The app and owned subprocesses exited; temporary build, toolchain and isolated state were deleted. The existing checkout stayed clean and unchanged. No source change or push was needed.

Unproven: physical trackpad pinch/momentum, physical mouse hardware, signed/notarized distribution, uninstrumented foreground launch, native macOS fullscreen Spaces, and other platforms or connection modes. This run verifies the packaged viewer behavior, not provider execution or event persistence.

Added 2 commits

  • Merge remote-tracking branch 'origin/main' into prbatch/2663056e699e
  • Merge origin/main into issue-watch/26611bc839b9