From a30541b793995147d3d0fece87f204ea450fc7cf Mon Sep 17 00:00:00 2001 From: Dotta <34892728+cryppadotta@users.noreply.github.com> Date: Thu, 3 Dec 2026 21:18:38 -0600 Subject: [PATCH] fix(ui): fade out task status update caret unless hovered (#23402) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work. > - On a task page, the activity thread shows status update rows such as "Ran commands, searched files" and their expanded activity rows. > - In `TaskChatRunnerActivityGroup`, the disclosure caret on the right edge stays at full opacity even when the user does not hover over the row. > - Other collapsible rows in the task thread (`TaskChatThinking`, `TaskChatProtocolActivityRow`) hide their disclosure carets at rest while preserving touch-device discoverability (`tc-hover-disclosure-caret`) and keeping expanded carets legible (`rotate-90 opacity-80`). > - This pull request fades out the right-side caret on runner activity phase toggles, folded read runs, and expandable activity rows unless hovered, keyboard-focused, or expanded, while sharing the repository's `.tc-hover-disclosure-caret` touch fallback. > - The benefit is a calmer task thread with no layout shift on hover, full keyboard accessibility, and consistent disclosure behavior across all task-chat rows. ## Linked Issues or Issue Description **What existing behavior does this improve?** The disclosure carets on the right side of task status update rows in `TaskChatRunnerActivityGroup` on the task page. **Subsystem affected** ui/ — React + Vite board UI **Current behavior** Activity status update rows such as "Ran commands, searched files", folded file-read rows, and expandable activity rows keep their right-side chevron caret visible at full opacity at rest. **Proposed behavior** When collapsed and not hovered, the right-side caret stays faded out (`opacity-0`). It fades in smoothly with the shared motion tokens (`--motion-duration-fast` and `--motion-ease-standard`) on row hover or keyboard `focus-visible`, and fades back out when hover or focus ends. While a row is expanded, the caret stays visible (`rotate-90 opacity-80`, brightening to `opacity-100` on hover/focus). All three carets include the shared `.tc-hover-disclosure-caret` class so touch-only devices (`@media (hover: none)`) keep the disclosure affordance discoverable. **Reason and benefit** Hiding the right-side caret at rest removes visual noise across activity updates in the task thread and aligns `TaskChatRunnerActivityGroup` with the existing hover-disclosure pattern in `TaskChatThinking`, `TaskChatProtocolActivityRow`, and `ui/src/index.css` (related: #12640, #15048). Using opacity instead of unmounting keeps row alignment stable on hover. **Breaking changes** None. ## What Changed - Extract a shared `DISCLOSURE_CARET_CLASS` constant in `ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx` including `tc-hover-disclosure-caret` and the shared motion tokens (`--motion-duration-fast`, `--motion-ease-standard`, `motion-reduce:transition-none`). - Add named group hooks (`group/activity-phase`, `group/read-run`, `group/activity-row`) to the three disclosure buttons in `TaskChatRunnerActivityGroup.tsx`. - Fade out each right-side `ChevronRight` caret at rest (`opacity-0`), reveal it on hover or keyboard focus (`group-hover/...:opacity-100`, `group-focus-visible/...:opacity-100`), and keep it visible while open (`rotate-90 opacity-80`). - Add unit tests in `ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx` covering completed summaries, active toggles, folded read runs, expanded activity rows, open/close state transitions, and `tc-hover-disclosure-caret`. ## Verification - Local focused Vitest on `0b46f7cf99`: `node node_modules/vitest/vitest.mjs run ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx ui/src/components/task-chat/antigravity-thread.test.tsx ui/src/components/task-chat/completed-activity-summary.test.ts` — 36/36 tests passed. - Local focused Vitest on `0b46f7cf99`: `node node_modules/vitest/vitest.mjs run ui/src/components/TaskChatThread.test.tsx` — 436 passed, 1 skipped. - Local token gates on `0b46f7cf99`: `pnpm check:token-gates` — all 4 token gates clean. - Local UI build on `0b46f7cf99`: `pnpm --filter @paperclipai/ui build` — built cleanly and verified compiled CSS emits `@media (hover:none){.tc-hover-disclosure-caret{opacity:1}}` and scoped `group-hover/*:opacity-100` rules. - GitHub Actions CI on `0b46f7cf99` ([run 46734780674](https://github.com/paperclipai/paperclip/actions/runs/46734780674)): all 30 checks passed (`ci / verify`, `ci / Build`, `ci / Typecheck + Release Registry`, `ci / General tests`, `ci / policy`, all 16 `ci / e2e` shards, `commitperclip PR Review`, `Socket Security`, `Superagent Security`, and `security/snyk`). - Automated reviews on `0b46f7cf99`: `ponytail-paperclip-review` (5/5, ship), `feynman-nuclear-review` (5/5), and `Greptile Review` (5/5; P2 note about `tc-hover-disclosure-caret` answered and resolved in-thread). ## Risks - Low risk. Only the opacity, rotation, and transition classes on the right-side disclosure carets change; click, expand/collapse, keyboard, and touch-device discoverability semantics stay intact. > This is a small UI polish change and does not overlap with planned core features in `ROADMAP.md`. ## Model Used - Google DeepMind Antigravity coding agent (Gemini model with reasoning/thinking mode, file editing, shell execution, and GitHub CLI tools; exact model ID and context window are not exposed by the runner environment). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip --- .../TaskChatRunnerActivityGroup.test.tsx | 176 ++++++++++++++++++ .../task-chat/TaskChatRunnerActivityGroup.tsx | 32 +++- 2 files changed, 202 insertions(+), 6 deletions(-) create mode 100644 ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx diff --git a/ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx b/ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx new file mode 100644 index 00000000000..23659218776 --- /dev/null +++ b/ui/src/components/task-chat/TaskChatRunnerActivityGroup.test.tsx @@ -0,0 +1,176 @@ +// @vitest-environment jsdom + +import { act } from "react"; +import { createRoot, type Root } from "react-dom/client"; +import { afterEach, describe, expect, it } from "vitest"; +import { TaskChatRunnerActivityGroup } from "./TaskChatRunnerActivityGroup"; +import type { TaskChatActivityPhaseItem, TaskChatToolItem } from "./task-chat-model"; + +(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + +let root: Root | null = null; +let container: HTMLDivElement | null = null; + +afterEach(() => { + act(() => root?.unmount()); + container?.remove(); + root = null; + container = null; +}); + +function toolItem( + id: string, + name: string, + target: string, + status: TaskChatToolItem["status"] = "completed", +): TaskChatToolItem { + return { + id, + kind: "tool", + name, + rawName: name, + target, + status, + }; +} + +function renderGroup(item: TaskChatActivityPhaseItem, defaultExpanded = false) { + container = document.createElement("div"); + document.body.append(container); + root = createRoot(container); + act(() => { + root!.render(); + }); + return container; +} + +describe("TaskChatRunnerActivityGroup disclosure carets", () => { + it("fades out the completed status summary caret unless hovered, focused, or expanded", () => { + const phase: TaskChatActivityPhaseItem = { + id: "phase-completed", + kind: "activity_phase", + active: false, + summary: "", + items: [ + toolItem("cmd-1", "Bash", "pnpm test"), + toolItem("grep-1", "Grep", "TaskChatRunnerActivityGroup"), + ], + }; + + const el = renderGroup(phase); + const toggle = el.querySelector('[data-testid="task-chat-activity-phase-toggle"]'); + expect(toggle).not.toBeNull(); + expect(toggle?.textContent).toContain("Ran commands, searched files"); + expect(toggle?.classList.contains("group/activity-phase")).toBe(true); + + const caret = toggle?.querySelector('[data-testid="task-chat-activity-phase-caret"]'); + expect(caret).not.toBeNull(); + expect(caret?.classList.contains("tc-hover-disclosure-caret")).toBe(true); + expect(caret?.classList.contains("opacity-0")).toBe(true); + expect(caret?.classList.contains("opacity-80")).toBe(false); + expect(caret?.classList.contains("transition-[opacity,transform]")).toBe(true); + expect(caret?.classList.contains("duration-(--motion-duration-fast)")).toBe(true); + expect(caret?.classList.contains("ease-(--motion-ease-standard)")).toBe(true); + expect(caret?.classList.contains("motion-reduce:transition-none")).toBe(true); + expect(caret?.classList.contains("group-hover/activity-phase:opacity-100")).toBe(true); + expect(caret?.classList.contains("group-focus-visible/activity-phase:opacity-100")).toBe(true); + expect(caret?.classList.contains("rotate-90")).toBe(false); + + act(() => { + toggle!.click(); + }); + expect(toggle?.getAttribute("aria-expanded")).toBe("true"); + expect(caret?.classList.contains("rotate-90")).toBe(true); + expect(caret?.classList.contains("opacity-80")).toBe(true); + expect(caret?.classList.contains("opacity-0")).toBe(false); + + act(() => { + toggle!.click(); + }); + expect(toggle?.getAttribute("aria-expanded")).toBe("false"); + expect(caret?.classList.contains("rotate-90")).toBe(false); + expect(caret?.classList.contains("opacity-80")).toBe(false); + expect(caret?.classList.contains("opacity-0")).toBe(true); + }); + + it("fades out the active status toggle caret unless hovered, focused, or expanded", () => { + const phase: TaskChatActivityPhaseItem = { + id: "phase-active", + kind: "activity_phase", + active: true, + summary: "", + items: [toolItem("cmd-1", "Bash", "pnpm test", "in_progress")], + }; + + const el = renderGroup(phase); + const toggle = el.querySelector('[data-testid="task-chat-activity-phase-toggle"]'); + expect(toggle).not.toBeNull(); + expect(toggle?.classList.contains("group/activity-phase")).toBe(true); + + const caret = toggle?.querySelector('[data-testid="task-chat-activity-phase-caret"]'); + expect(caret).not.toBeNull(); + expect(caret?.classList.contains("tc-hover-disclosure-caret")).toBe(true); + expect(caret?.classList.contains("opacity-0")).toBe(true); + expect(caret?.classList.contains("group-hover/activity-phase:opacity-100")).toBe(true); + expect(caret?.classList.contains("group-focus-visible/activity-phase:opacity-100")).toBe(true); + }); + + it("fades out disclosure carets on expanded activity rows and folded read runs unless hovered, focused, or open", () => { + const phase: TaskChatActivityPhaseItem = { + id: "phase-expanded", + kind: "activity_phase", + active: false, + summary: "", + items: [ + toolItem("read-1", "Read", "src/a.ts"), + toolItem("read-2", "Read", "src/b.ts"), + toolItem("read-3", "Read", "src/c.ts"), + toolItem("cmd-1", "Bash", "git status"), + ], + }; + + const el = renderGroup(phase, true); + + const readRunButton = el.querySelector("[data-activity-read-run] > button"); + expect(readRunButton).not.toBeNull(); + expect(readRunButton?.classList.contains("group/read-run")).toBe(true); + + const readRunCaret = readRunButton?.querySelector('[data-testid="task-chat-read-run-caret"]'); + expect(readRunCaret).not.toBeNull(); + expect(readRunCaret?.classList.contains("tc-hover-disclosure-caret")).toBe(true); + expect(readRunCaret?.classList.contains("opacity-0")).toBe(true); + expect(readRunCaret?.classList.contains("opacity-80")).toBe(false); + expect(readRunCaret?.classList.contains("transition-[opacity,transform]")).toBe(true); + expect(readRunCaret?.classList.contains("group-hover/read-run:opacity-100")).toBe(true); + expect(readRunCaret?.classList.contains("group-focus-visible/read-run:opacity-100")).toBe(true); + + act(() => { + readRunButton!.click(); + }); + expect(readRunButton?.getAttribute("aria-expanded")).toBe("true"); + expect(readRunCaret?.classList.contains("rotate-90")).toBe(true); + expect(readRunCaret?.classList.contains("opacity-80")).toBe(true); + expect(readRunCaret?.classList.contains("opacity-0")).toBe(false); + + const rowButton = el.querySelector('[data-activity-item-id="cmd-1"] > button'); + expect(rowButton).not.toBeNull(); + expect(rowButton?.classList.contains("group/activity-row")).toBe(true); + + const rowCaret = rowButton?.querySelector('[data-testid="task-chat-activity-row-caret"]'); + expect(rowCaret).not.toBeNull(); + expect(rowCaret?.classList.contains("tc-hover-disclosure-caret")).toBe(true); + expect(rowCaret?.classList.contains("opacity-0")).toBe(true); + expect(rowCaret?.classList.contains("opacity-80")).toBe(false); + expect(rowCaret?.classList.contains("transition-[opacity,transform]")).toBe(true); + expect(rowCaret?.classList.contains("group-hover/activity-row:opacity-100")).toBe(true); + expect(rowCaret?.classList.contains("group-focus-visible/activity-row:opacity-100")).toBe(true); + + act(() => { + rowButton!.click(); + }); + expect(rowButton?.getAttribute("aria-expanded")).toBe("true"); + expect(rowCaret?.classList.contains("rotate-90")).toBe(true); + expect(rowCaret?.classList.contains("opacity-80")).toBe(true); + expect(rowCaret?.classList.contains("opacity-0")).toBe(false); + }); +}); diff --git a/ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx b/ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx index 7b88eef55f4..2f569907a2d 100644 --- a/ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx +++ b/ui/src/components/task-chat/TaskChatRunnerActivityGroup.tsx @@ -41,6 +41,8 @@ type Activity = TaskChatActivityPhaseItem["items"][number]; type ToolActivity = Extract; const READ_RUN_MIN = 3; +const DISCLOSURE_CARET_CLASS = + "tc-hover-disclosure-caret size-3.5 shrink-0 transition-[opacity,transform] duration-(--motion-duration-fast) ease-(--motion-ease-standard) motion-reduce:transition-none"; /** "120ms", "1.2s", "14s", "2m 03s". */ export function formatToolDuration(ms: number): string { @@ -481,15 +483,20 @@ function ExpandedActivity({ {expandable ? ( ) : ( @@ -553,7 +560,7 @@ function ReadRunActivity({ items }: { items: ToolActivity[] }) {
  • {open ? (
      @@ -630,7 +645,7 @@ export function TaskChatRunnerActivityGroup({