From 360ae135b3a18b488801f9cc83748dd71e1e2fb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Thu, 23 Jul 2026 14:44:20 +0100 Subject: [PATCH] fix(web): clarify task title editing (#1875) --- .../components/task/task-top-bar-title.test.tsx | 14 +++++++++++++- apps/web/components/task/task-top-bar-title.tsx | 7 ++++++- apps/web/e2e/tests/task/topbar-rename.spec.ts | 17 ++++++++++++++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/apps/web/components/task/task-top-bar-title.test.tsx b/apps/web/components/task/task-top-bar-title.test.tsx index 0b49a8a2b2..55fc226aa3 100644 --- a/apps/web/components/task/task-top-bar-title.test.tsx +++ b/apps/web/components/task/task-top-bar-title.test.tsx @@ -7,7 +7,9 @@ const mockRename = vi.hoisted(() => vi.fn(() => Promise.resolve())); vi.mock("@kandev/ui/tooltip", () => ({ Tooltip: ({ children }: { children: React.ReactNode }) => <>{children}, TooltipTrigger: ({ children }: { children: React.ReactNode }) => <>{children}, - TooltipContent: ({ children }: { children: React.ReactNode }) => <>{children}, + TooltipContent: ({ children }: { children: React.ReactNode }) => ( +
{children}
+ ), })); vi.mock("@/hooks/use-task-actions", () => ({ @@ -44,11 +46,20 @@ describe("TaskTopBarTitle — idle state", () => { expect(getTitle().getAttribute("tabindex")).toBe("0"); }); + it("shows the full title and edit hint in the tooltip when renameable", () => { + render(); + + expect(screen.getByRole("tooltip").textContent).toBe( + "My taskDouble-click to edit (or press Enter)", + ); + }); + it("keeps the breadcrumb aria-disabled and unfocusable when the task is archived", () => { render(); expect(getTitle().getAttribute("aria-disabled")).toBe("true"); expect(getTitle().getAttribute("tabindex")).toBeNull(); + expect(screen.getByRole("tooltip").textContent).toBe("My task"); }); it("does not enter edit mode when the task is archived", () => { @@ -65,6 +76,7 @@ describe("TaskTopBarTitle — idle state", () => { fireEvent.doubleClick(getTitle()); expect(queryInput()).toBeNull(); + expect(screen.getByRole("tooltip").textContent).toBe("My task"); }); }); diff --git a/apps/web/components/task/task-top-bar-title.tsx b/apps/web/components/task/task-top-bar-title.tsx index 89bf5b43f5..7751848373 100644 --- a/apps/web/components/task/task-top-bar-title.tsx +++ b/apps/web/components/task/task-top-bar-title.tsx @@ -110,7 +110,12 @@ export function TaskTopBarTitle({ taskId, taskTitle, isArchived }: TaskTopBarTit {taskTitle ?? "Task details"} - {taskTitle ?? "Task details"} + + {taskTitle ?? "Task details"} + {canRename && ( + Double-click to edit (or press Enter) + )} + diff --git a/apps/web/e2e/tests/task/topbar-rename.spec.ts b/apps/web/e2e/tests/task/topbar-rename.spec.ts index f058863549..a7d3c88d1c 100644 --- a/apps/web/e2e/tests/task/topbar-rename.spec.ts +++ b/apps/web/e2e/tests/task/topbar-rename.spec.ts @@ -2,16 +2,19 @@ import { test, expect } from "../../fixtures/test-base"; import { SessionPage } from "../../pages/session-page"; test.describe("Task topbar inline rename", () => { - test("renames the task by double-clicking the title and pressing Enter", async ({ + test("hints at editing before renaming the task by double-clicking the title", async ({ testPage, apiClient, seedData, }) => { test.setTimeout(90_000); + const originalTitle = + "Topbar rename original with a deliberately long title that is truncated in the task header"; + const task = await apiClient.createTaskWithAgent( seedData.workspaceId, - "Topbar rename original", + originalTitle, seedData.agentProfileId, { description: "/e2e:simple-message", @@ -26,7 +29,15 @@ test.describe("Task topbar inline rename", () => { await session.waitForLoad(); const title = testPage.locator('[data-testid="task-topbar"] [aria-current="page"]'); - await expect(title).toHaveText("Topbar rename original", { timeout: 10_000 }); + await expect(title).toHaveText(originalTitle, { timeout: 10_000 }); + + await title.hover(); + const tooltip = testPage + .locator('[data-slot="tooltip-content"][data-state]') + .filter({ hasText: originalTitle }); + await expect(tooltip).toBeVisible(); + await expect(tooltip).toContainText(originalTitle); + await expect(tooltip).toContainText("Double-click to edit (or press Enter)"); await title.dblclick(); const input = testPage.getByTestId("task-title-rename-input");