Repository navigation
improve(chat): show pending attachments as compact pills - #2150
Conversation
Replace the wide 56px composer attachment card with a Copilot-style pill: at least 28px tall (grows with text scaling), sized to the file name up to 216px, with a 24px remove button revealed on hover, keyboard focus or touch. Pills are keyed to their attachment; removing one moves focus to the next file's remove button or the editor. Remove buttons are named for their file in all six locales, keep the composer readiness guard, and the rail clears the overlaid scroll bar while it can scroll. Co-authored-by: Copilot App <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR replaces wide pending-attachment cards with compact pills, localized remove labels, and deliberate focus handoff. Example: Attach draft.txt to a chat message.
Review scores
ProductKind: Preference · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-authored improvement is absent from main, but two added readiness waits cause the current CI timing guard to fail. Priority: P3 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Reactor composer reads pending attachments from ChatComposerViewModel, renders native WinUI controls, and forwards removals to ChatComposerController. flowchart LR
A[Pending attachments] --> B[ChatComposerViewModel]
B --> C[ReactorChatComposer]
C --> D[ChatAttachmentChip]
D --> E[Remove activation]
E --> F[ChatComposerController]
F --> B
Technical reviewBest possible solution: Keep the focused chip component and existing attachment owners, replacing the added fixed-delay waits with observable rendered-state waits. Do we have a high-confidence way to reproduce the issue? This is an intentional presentation change; current-main source and the supplied before screenshot establish the existing wide-card behavior. Is this the best way to solve the issue? The problem is bulky attachment presentation; the invariant is bounded, removable attachments with stable editor and focus behavior. A keyed chip component is justified by its independent hover and focus state, while removal remains with the existing controller and view model. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 028bcd997434. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 13, 2026, 12:24 AM ET / 05:24 UTC. |
Pending attachment pills now wrap onto new rows and grow the composer, like the GitHub Copilot app. Past four rows at default text size (136px) the rail scrolls vertically, with a permanently reserved gutter for the overlaid scroll bar. Pills keep their content width inside the flex row so short names are not trimmed. Co-authored-by: Copilot App <[email protected]>
… focus Size the pill's maximum width from the rail's real row width (border and reserved scroll-bar gutter included, no floor) so long pills never overflow narrow chat panes. Pointer focus no longer reveals the remove button. Query touch hardware once per process. Measure rail rows instead of counting them in the UI test, add a 260px case, and correct the design doc's rail and focus wording. Co-authored-by: Copilot App <[email protected]>
Main's timing-pattern guard rejects fixed SettleAsync readiness. Replace the rail test's settle waits with WaitForRenderedConditionAsync on stable pill layout, revealed buttons, focus scrolling and focus handoff. Keep one annotated settle for the negative pointer-focus check, which has no positive signal to wait for. Co-authored-by: Copilot App <[email protected]>
…e-chat-styling # Conflicts: # src/OpenClaw.Tray.WinUI/Chat/ReactorChatComposer.cs
Raster image attachments in the composer now render as 96px square thumbnails on their own wrapping row above the file pills, like the GitHub Copilot app, with the named remove button as an opaque badge on the tile's top-right corner. Thumbnails decode once per attachment at a 256px bound. SVG and undecodable images stay file pills. Focus order and removal handoff follow the visual order (tiles, then pills). Co-authored-by: Copilot App <[email protected]>
Shrink composer image tiles from 96px to the web composer's 56px and lower the thumbnail decode bound to 192 physical pixels. Co-authored-by: Copilot App <[email protected]>
What Problem This Solves
The native chat composer shows each pending attachment as a wide, borderless 56px card that blends into the composer, with the remove button stranded at the far end.
User Impact
User impact: attached images appear as square thumbnails on their own row, and files as compact, Copilot-style pills that size to the file name. When they don't fit on one line they wrap onto more rows and the composer grows, up to about four rows before the attachment area scrolls.
The remove target shrinks from 32px to 24px (the WCAG 2.5.8 minimum) and appears on hover, keyboard focus or touch-capable devices (not on pointer focus alone). It always stays in keyboard and Narrator order.
Why This Change Was Made
A new
ChatAttachmentChipReactor component renders each pending attachment as a pill: at least 28px tall, fully rounded, subtle fill, 14px document glyph and a 12px SemiBold name, up to 216px wide. Colors come from two new theme brushes; high contrast adds an outline.Pills are keyed to their attachment, so hover and focus state never moves to another file. Removing a file moves focus to the next file's remove button, or to the editor after the last file. Remove buttons are named for their file (
Remove attachment {name}, in all six locales) and keep the composer's existing layout-readiness guard.The rail is a wrapping flex row rather than a horizontal scroller. It grows the composer up to 136px (four rows at default text size), then scrolls vertically with a permanently reserved gutter so the overlaid scroll bar never covers remove buttons. Pills use content-sized columns so the flex layout cannot squeeze short names into an ellipsis, and their maximum width follows the rail's real row width so long pills never overflow narrow panes.
Dual-model review dispositions
A two-model review (claude-opus-5.5 and gpt-6-astra) of the first version found six issues; all are fixed in this PR:
MinHeightinstead ofHeightComposerAutomationVisibilityA follow-up rubber-duck review of these fixes found that focus selection read a render-time attachment list; it now reads the live list, with a regression for two removals before a re-render. The reviewer confirmed all its findings resolved with no new blocking issues.
A repeat two-model review of
65eb6ab1(claude-opus-5.5 and gpt-6-astra, high reasoning) found no blocking issues and confirmed the earlier fixes. Its five findings are fixed in0b320470: pill width now accounts for the rail border and gutter (overflow below about 286px), the test measures rows instead of counting them, pointer focus no longer reveals the remove button, touch hardware is queried once per process, and the design doc wording is corrected.A review of the later switch to wrapping rows found that toggling the scroll-bar gutter with overflow could keep its own overflow alive after widening the window; the gutter is now always reserved. It also asked for the cap to be stated as pixels (scaled text fits fewer rows) and for proof that keyboard focus scrolls an off-screen pill into view; both are addressed.
Evidence
After (current head, light theme, 480px), from the
AttachmentRail_BoundsManyFilesAndKeepsRemovalReachablevisual capture after three keyboard removals:Pills wrap onto a second row and the composer grows to fit.
a.txtshows in full, long names trim inside 216px pills, and keyboard focus has moved to the surviving file's remove button.Image attachments render as 56px tiles (the web composer's thumbnail size) on their own row above the file pills, with the remove badge on the corner (480px, keyboard focus on the badge; the test image is an 8x8 PNG scaled up):
Before (synthetic chat, previous composer card for
draft.txt):Change Type
Scope
winnodeRequired proof pools
windows-winui-interactive: the composer attachment UI changed; hover reveal, dark and high-contrast rendering and Narrator announcements still need interactive proof in the isolated WinUI app.Validation
Run locally on Windows 11 ARM64 against the working tree committed as
b67863bc(includes themainmerge atbd6a2dbd) (no source edits after the final run)../build.ps1: all five projects built.dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj: 5,862 passed, 29 skipped, 0 failed.dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj: 6,441 passed, 0 failed (includes localization validation and the composer readiness-guard source test).dotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-arm64 --no-build --filter "FullyQualifiedName~AttachmentRail_BoundsManyFilesAndKeepsRemovalReachable|FullyQualifiedName~ComposerStatusRows_KeepNativeInputCaretAndToolbar": 7 passed (rail at 260, 320, 480 and 800; image tiles at 260 and 480; composer status rows). The rail test asserts no horizontal scrolling, at least two wrapped rows, the 136px cap with vertical scrolling only when the measured rows exceed it, an untrimmed short name, remove buttons clear of the scroll-bar gutter, pointer focus not revealing the remove button, and that keyboard focus scrolls an off-screen pill into view.main, its new timing-pattern guard rejected the rail test's fixedSettleAsyncwaits. The test now waits for observable state (stable pill layout, revealed buttons, focus scrolling, focus handoff) withWaitForRenderedConditionAsync, keeping one annotated settle for the negative pointer-focus check. The guard passes.0b320470: restoring the old width formula failed the 260px case; letting pointer focus reveal the button failed all four widths. Source restored before the final run.Notes:
--no-restorereported 207 failures in unchanged shared code; the final run from the real worktree path passed. No shared code changed in this PR.Real Behavior Proof
b67863bc(working tree identical to the commit at test time).OPENCLAW_VISUAL_TEST=1withdotnet test tests/OpenClaw.Tray.UITests -c Debug -r win-arm64 --no-build --filter FullyQualifiedName~AttachmentRail_BoundsManyFilesAndKeepsRemovalReachableYes/No/N/A) YesMinHeightin code, not by a capture).Security Impact
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain the risk and mitigation: N/ACompatibility and Migration
Yes/No) YesYes/No) NoYes/No) NoReview Conversations