Skip to content

fix(native-chat): open inline images directly in preview dialog - #31620

Merged
AmethystLiang merged 2 commits into
mainfrom
allow-opening-image-preview-in-dialog
Oct 22, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
allow-opening-image-preview-in-dialog

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​504 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​504
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​528 $\color{#cf222e}{\Huge{\mathbf{−}}}$​39 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​489

ELI5

Clicking an image in chat now opens it directly in the image viewer. File actions are available from the viewer toolbar.

What Changed

  • Reuse the existing pan-and-zoom dialog for inline Markdown images, including table cells and linked images.
  • Keep Open file, system-app, and Reveal actions in a secondary menu. Preserve ordinary text-link behavior and modifier shortcuts.
  • Load file images using the chat's execution owner, preserve keyboard focus and streaming state, and close previews when their chat becomes hidden.
  • Include the reviewed design in docs/native-chat-inline-image-preview-design.md.

Why

Rendered images were forwarded to ordinary link routing, so the file-actions popup interrupted image viewing. A chat-specific Markdown renderer reuses the existing viewer and file-action builders.

Linked Issue

Requested directly by the user; no existing linked issue.

Visual Proof

Before: reported intermediate popup After: direct image dialog
Before After
Secondary file actions Dark theme, narrow viewport
File actions Narrow preview

Screenshots come from hidden Electron renderers on macOS. Evidence is stored outside the PR diff.

Testing

  • 66 tests across seven focused suites; final image/visual-extension regression rerun: 23 passed.
  • pnpm tc:web and pnpm run check:code-quality:changed passed.
  • E2E renderer build and portable native-chat-inline-image-preview.spec.ts passed, including a final assertion that no file-action popup opens on image click.
  • Visual verification: light/dark, 480px viewport, menu actions, zoom/fit, Enter/Space, Escape order, Close, focus restoration, and hidden/unfocused native windows. All app/test runs used ORCA_BACKGROUND_LAUNCH=1.
  • Additional existing native-chat-copy-image.spec.ts stopped before image interaction: macOS could not allocate another PTY (posix_openpt, errno 6), leaving its composer disabled. The new preview E2E passed in the same run; no user terminals were stopped.

Review

GPT-6.1 Sol high agents authored/reviewed the design, implemented the change, and reviewed/fixed the code. No blocking review findings remain. GPT-5.6 Terra medium performed the rendered visual checks and inspected the screenshots.

Agent skill upstream boundary

  • This change copies no upstream skill-installer implementation or documentation.

Notes

Remote owner/read behavior is covered at the runtime boundary with simulated remote reads. Native Windows/Linux, live SSH, and native mobile were not run locally. Native mobile uses a separate renderer; this change adds no IPC or wire-format requirement.

Checklist

  • Focused behavior change with reviewed design and before/after evidence.
  • Self-reviewed for correctness, security, and performance.
  • Cross-platform paths/shortcuts, remote ownership, folder workspaces, and mobile considered.
  • Full lint/typecheck/test/build matrix will run in CI; focused local checks are listed above.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a4c386f4-b5dc-449c-a76b-061fed6ba5c1
📥 Commits

Reviewing files that changed from the base of the PR and between b2305b0 and 0792104.

📒 Files selected for processing: 1
  • src/renderer/src/i18n/locales/en.json

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

📝 Walkthrough

Native-chat document Markdown now renders inline images with expandable previews and owner-aware source loading. The shared lightbox and image dialog support controlled state, custom actions, and conditional focus restoration. Ordinary links retain separate handling. Unit and end-to-end tests cover preview interactions, ownership and loading states, and display modes. The design record documents implementation boundaries and validation results.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 07921

This change only adds preview-related translations and is ready to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (1 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: inline native-chat images now open directly in the preview dialog.
Description check Passed The description is directly related to the changeset and explains the image preview behavior, file actions, focus handling, testing, limitations, and design documentation.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 13 functions across 8 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e9b84930-f919-43d2-b463-5cc81f2f6895
📥 Commits

Reviewing files that changed from the base of the PR and between b3f1607 and b2305b0.

📒 Files selected for processing: 9
  • docs/native-chat-inline-image-preview-design.md
  • src/renderer/src/components/editor/PanZoomImageDialog.tsx
  • src/renderer/src/components/native-chat/NativeChatMarkdown.image-preview.test.tsx
  • src/renderer/src/components/native-chat/NativeChatMarkdown.tsx
  • src/renderer/src/components/native-chat/NativeChatMarkdownImage.tsx
  • src/renderer/src/components/native-chat/NativeChatView.tsx
  • src/renderer/src/components/native-chat/native-chat-markdown-image-owner.tsx
  • src/renderer/src/components/sidebar/MarkdownImageLightbox.tsx
  • tests/e2e/native-chat-inline-image-preview.spec.ts

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

@AmethystLiang
AmethystLiang merged commit ad0bf9a into main Oct 22, 2026
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant