#6663: Web UI: handle drag-drop image attachments
app: web-ui
Cluster:
Web UI Enhancements and Fixes
What’s in this PR
Treat drag‑and‑drop images in WebChat as attachments instead of navigating away.
Reuse the same attachment pipeline as paste.
Add changelog entry for #6525.
Why
Dragging images into the chat currently triggers browser navigation (opens the image). This blocks the intended attachment workflow.
Testing
Manual: WebChat drag‑drop image shows attachment preview and can be sent.
Issue
#6525
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the Web UI chat view to treat dragged-and-dropped images as chat attachments rather than allowing the browser’s default navigation behavior. It refactors the existing paste-image handling into shared helpers (`readFileAsDataUrl`, file extraction helpers, and `appendImageAttachments`), adds drop/dragover listeners on the chat container to intercept file drops, and documents the change in the changelog (#6525).
<h3>Confidence Score: 4/5</h3>
- This PR is generally safe to merge; main risk is cross-browser drag/drop behavior.
- The change is localized to the chat UI event handlers and reuses the existing attachment pipeline, so blast radius is small. The one notable concern is browser inconsistencies around `DataTransfer.types`, which could prevent `dragover.preventDefault()` and reintroduce navigation in some environments.
- ui/src/ui/views/chat.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#8284: Fix: Webchat images now persist after sending
by vishaltandale00 · 2026-02-03
81.6%
#4327: Gateway Web Chat: add image/file upload (attach, drag-drop, paste)
by RogerHsu7 · 2026-01-30
79.3%
#10441: webchat: switch file uploads to HTTP /uploads
by supernewbilityxht1 · 2026-02-06
77.9%
#22113: feat: support non-image file attachments in webchat chat.send
by Kt-L · 2026-02-20
76.9%
#22333: Fix webchat inline image rendering and size handling
by AIflow-Labs · 2026-02-21
75.8%
#22781: fix(webchat): persist chat attachments after guards and expose medi...
by Kansodata · 2026-02-21
73.3%
#18685: fix(ui): prevent tabnabbing in chat images
by Mariana-Codebase · 2026-02-16
73.1%
#4269: fix: support tool result image format in Control UI
by bobcyw · 2026-01-30
72.5%
#7522: fix(webchat): auto-scroll when message queue changes
by alsoknownasfoo · 2026-02-02
72.4%
#20392: feat(tui): add image attachment support via /image command and drag...
by markshields-tl · 2026-02-18
72.3%