cmux NEXT composer: drag staged attachments to reorder them

Merged
TE
12d ago
+472-10

Stacked on #24976 (which is stacked on #24975).

Leo, 2026-10-24: "we ought to be able to drag and reorder images if we're seeing the non-inline attachment composer".

What changes

  • A staged chip in the attachment strip can be dragged along it. It lifts a little and moves as the pointer passes the other chips' centers. The prompt sends attachments in the strip's order (promptBlocks reads the staged list in order).
  • Option-Left and Option-Right move a focused chip, for the keyboard.
  • This uses pointer events, not HTML drag and drop. A drag here never carries files, so the page's file drop and its overlay never see it. The images inside chips are draggable={false}, so WebKit never starts dragging the picture out as a file.
  • The press that ends a drag opens nothing and removes nothing. A plain click still opens the image viewer.
  • Each chip sits in a display: contents slot marked by its index, so layout is unchanged and no chip id (which can hold a file name) is written into the page. Wired in the chat composer, NewTabScreen and the classic NewTabPage.

Tests: agent-pane-attach-reorder.test.ts (Chromium): drag the first of three pasted screenshots past the last gives 400, 500, 300 with no viewer opened; Option-Right, Option-Right, Option-Left step a chip; a plain click still opens the viewer. attachment-thumbnails, agent-pane-attach-typing, composer-attachments and agent-pane-paste-large-screenshots pass. Gallery: new agent-pane.composer state attachment-reorder, a chip mid-drag.

Risk: low. The strip only gains a listener for pointer and key events, which act when a composer passes onReorder and there are two or more chips.

Agent session: huge-blue

šŸ¤– Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.