diff --git a/apps/web/components/confirmation/action-confirm-popover.test.tsx b/apps/web/components/confirmation/action-confirm-popover.test.tsx index 795ac0e8dd..09debf097b 100644 --- a/apps/web/components/confirmation/action-confirm-popover.test.tsx +++ b/apps/web/components/confirmation/action-confirm-popover.test.tsx @@ -60,13 +60,20 @@ describe("ActionConfirmPopover", () => { it("supports a wider bounded surface without changing the default width", async () => { render(); - expect(screen.getByRole("dialog").className).toContain("w-64"); + const defaultDialog = screen.getByRole("dialog"); + expect(defaultDialog.className).toContain("w-64"); + expect( + defaultDialog.querySelector('[data-slot="popover-description"]')?.className, + ).not.toContain("text-pretty"); cleanup(); render(); const wideDialog = screen.getByRole("dialog"); expect(wideDialog.className).toContain("w-72"); expect(wideDialog.className).toContain("max-w-[calc(100vw-1rem)]"); + expect( + wideDialog.querySelector('[data-slot="popover-description"]')?.className, + ).toContain("text-pretty"); }); it("closes before invoking an unresolved confirmation and returns focus on cancel", async () => { diff --git a/apps/web/components/confirmation/action-confirm-popover.tsx b/apps/web/components/confirmation/action-confirm-popover.tsx index ad4ed7a61b..3dc1a14749 100644 --- a/apps/web/components/confirmation/action-confirm-popover.tsx +++ b/apps/web/components/confirmation/action-confirm-popover.tsx @@ -216,7 +216,12 @@ function ActionConfirmPopoverContent({ {title} {description ? ( - {description} + + {description} + ) : null}
diff --git a/apps/web/components/task/session-delete-description.tsx b/apps/web/components/task/session-delete-description.tsx index 5d223b7f8a..b880b1936e 100644 --- a/apps/web/components/task/session-delete-description.tsx +++ b/apps/web/components/task/session-delete-description.tsx @@ -5,15 +5,29 @@ import { useTranslation } from "react-i18next"; export function SessionDeleteDescription({ isPrimary, isOnlySession, + structured = false, }: { isPrimary: boolean; isOnlySession: boolean; + structured?: boolean; }) { const { t } = useTranslation(); + const primaryNotice = isPrimary && !isOnlySession; + + if (structured) { + return ( + <> +

{t("task:thisWillPermanentlyDeleteTheConversation")}

+ {primaryNotice &&

{t("task:thisIsThePrimarySessionAnother")}

} + {isOnlySession &&

{t("task:thisIsTheOnlySessionFor")}

} + + ); + } + return ( <> {t("task:thisWillPermanentlyDeleteTheConversation")} - {isPrimary && !isOnlySession && ( + {primaryNotice && ( {t("task:thisIsThePrimarySessionAnother")} )} {isOnlySession && ( diff --git a/apps/web/components/task/session-tab-menu.test.tsx b/apps/web/components/task/session-tab-menu.test.tsx index 7f6e353d3d..1d1690adee 100644 --- a/apps/web/components/task/session-tab-menu.test.tsx +++ b/apps/web/components/task/session-tab-menu.test.tsx @@ -26,6 +26,12 @@ describe("DeleteSessionDialog", () => { expect(dialog.textContent).toContain("permanently delete the conversation history"); expect(dialog.textContent).toContain("task workspace and its files are kept"); expect(dialog.textContent).toContain("only session for this task"); + const description = dialog.querySelector('[data-slot="alert-dialog-description"]'); + expect(description).not.toBeNull(); + expect(description?.id).toBe(dialog.getAttribute("aria-describedby")); + expect(description?.classList.contains("min-w-0")).toBe(true); + expect(description?.classList.contains("text-left")).toBe(true); + expect(description?.querySelectorAll("p")).toHaveLength(2); // No uncommitted/unpushed warning belongs on session deletion. expect(dialog.textContent).not.toContain("uncommitted"); expect(dialog.textContent).not.toContain("unpushed"); diff --git a/apps/web/components/task/session-tab-menu.tsx b/apps/web/components/task/session-tab-menu.tsx index 2875970e13..a539b87160 100644 --- a/apps/web/components/task/session-tab-menu.tsx +++ b/apps/web/components/task/session-tab-menu.tsx @@ -53,8 +53,12 @@ export function DeleteSessionDialog({ {t("task:deleteSession")} -
- +
+
diff --git a/apps/web/components/task/task-detach-confirm-dialog.test.tsx b/apps/web/components/task/task-detach-confirm-dialog.test.tsx index 1923b1bcbd..0028c5e9a3 100644 --- a/apps/web/components/task/task-detach-confirm-dialog.test.tsx +++ b/apps/web/components/task/task-detach-confirm-dialog.test.tsx @@ -70,17 +70,25 @@ describe("task detach confirmation adapters", () => { }); it("keeps task-switcher detachment on its existing modal branch", async () => { + const longTaskTitle = `Child task ${"x".repeat(180)}`; render( , ); - await waitFor(() => - expect(screen.getByRole("alertdialog", { name: "Detach task from parent?" })).not.toBeNull(), - ); + await waitFor(() => { + const dialog = screen.getByRole("alertdialog", { name: "Detach task from parent?" }); + const description = dialog.querySelector('[data-slot="alert-dialog-description"]'); + expect(description).not.toBeNull(); + expect(description?.id).toBe(dialog.getAttribute("aria-describedby")); + expect(description?.classList.contains("min-w-0")).toBe(true); + expect(description?.classList.contains("text-left")).toBe(true); + expect(description?.querySelectorAll("p")).toHaveLength(3); + expect(description?.textContent).toContain(longTaskTitle); + }); }); }); diff --git a/apps/web/components/task/task-detach-confirm-dialog.tsx b/apps/web/components/task/task-detach-confirm-dialog.tsx index 7916a095f0..9b5695e037 100644 --- a/apps/web/components/task/task-detach-confirm-dialog.tsx +++ b/apps/web/components/task/task-detach-confirm-dialog.tsx @@ -28,13 +28,32 @@ export type TaskDetachConfirmationCopyProps = { function TaskDetachDescription({ taskTitle, sharesParentWorkspace, -}: TaskDetachConfirmationCopyProps): ReactNode { + structured = false, +}: TaskDetachConfirmationCopyProps & { structured?: boolean }): ReactNode { const { t } = useTranslation(); + const title = taskTitle || t("task:thisTask2"); + + if (structured) { + return ( + <> +

+ {t("task:detachWillBecomeTopLevel", { + taskTitle: title, + })} +

+

{t("task:detachingChangesTheHierarchyOnlyAccess")}

+ {sharesParentWorkspace && ( +

{t("task:thisTaskSharesItsParentS")}

+ )} + + ); + } + return ( {t("task:detachWillBecomeTopLevel", { - taskTitle: taskTitle || t("task:thisTask2"), + taskTitle: title, })} {t("task:detachingChangesTheHierarchyOnlyAccess")} @@ -208,10 +227,11 @@ export function TaskDetachConfirmDialog({ {t(DETACH_TASK_FROM_PARENT_KEY)} -
+
diff --git a/apps/web/components/task/task-reset-env-confirm-dialog.test.tsx b/apps/web/components/task/task-reset-env-confirm-dialog.test.tsx new file mode 100644 index 0000000000..6bec62a45d --- /dev/null +++ b/apps/web/components/task/task-reset-env-confirm-dialog.test.tsx @@ -0,0 +1,70 @@ +import { cleanup, fireEvent, render, screen } from "@testing-library/react"; +import { afterEach, describe, expect, it, vi } from "vitest"; + +import { TaskResetEnvConfirmDialog } from "./task-reset-env-confirm-dialog"; + +afterEach(cleanup); + +describe("TaskResetEnvConfirmDialog", () => { + it("renders structured warning copy through one left-aligned description", () => { + render( + , + ); + + const dialog = screen.getByRole("alertdialog", { name: "Reset environment?" }); + const description = dialog.querySelector('[data-slot="alert-dialog-description"]'); + expect(description).not.toBeNull(); + expect(description?.id).toBe(dialog.getAttribute("aria-describedby")); + expect(description?.classList.contains("min-w-0")).toBe(true); + expect(description?.classList.contains("text-left")).toBe(true); + expect(description?.querySelectorAll("p")).toHaveLength(2); + expect(description?.textContent).toContain("Any uncommitted or unpushed changes"); + }); + + it("requires acknowledgment and passes the push-branch choice to confirmation", () => { + const onConfirm = vi.fn(); + render( + , + ); + + const confirm = screen.getByTestId("reset-env-confirm") as HTMLButtonElement; + expect(confirm.disabled).toBe(true); + + fireEvent.click( + screen.getByRole("checkbox", { + name: /push the current branch to its remote before resetting/i, + }), + ); + fireEvent.click( + screen.getByRole("checkbox", { + name: /I understand any uncommitted changes will be lost/i, + }), + ); + + expect(confirm.disabled).toBe(false); + fireEvent.click(confirm); + expect(onConfirm).toHaveBeenCalledWith({ pushBranch: true }); + }); + + it("locks both choices and confirmation while resetting", () => { + render( + , + ); + + for (const checkbox of screen.getAllByRole("checkbox")) { + expect((checkbox as HTMLButtonElement).disabled).toBe(true); + } + expect((screen.getByTestId("reset-env-confirm") as HTMLButtonElement).disabled).toBe(true); + }); +}); diff --git a/apps/web/components/task/task-reset-env-confirm-dialog.tsx b/apps/web/components/task/task-reset-env-confirm-dialog.tsx index 6635e8e72d..28771ac35b 100644 --- a/apps/web/components/task/task-reset-env-confirm-dialog.tsx +++ b/apps/web/components/task/task-reset-env-confirm-dialog.tsx @@ -49,7 +49,7 @@ export function TaskResetEnvConfirmDialog({ {t("task:resetEnvironment")} -
+

{t("task:thisTearsDownTheCurrentContainer")}

{t("task:anyUncommittedOrUnpushedChangesIn")}

diff --git a/docs/plans/surface-text-hierarchy/plan.md b/docs/plans/surface-text-hierarchy/plan.md index b4d9f53342..3bf81c2b43 100644 --- a/docs/plans/surface-text-hierarchy/plan.md +++ b/docs/plans/surface-text-hierarchy/plan.md @@ -106,7 +106,7 @@ the final composition. - [x] [Task 01: Standardize surface typography primitives](task-01-standardize-surface-typography-primitives.md) (completed) - [x] [Task 02: Normalize structured app confirmations](task-02-normalize-structured-app-confirmations.md) (completed) - [x] [Task 03: Refine task cleanup confirmations](task-03-refine-task-cleanup-confirmations.md) (completed) -- [ ] [Task 04: Normalize structured task confirmations](task-04-normalize-structured-task-confirmations.md) +- [x] [Task 04: Normalize structured task confirmations](task-04-normalize-structured-task-confirmations.md) (completed) - [ ] [Task 05: Add responsive text hierarchy E2E](task-05-add-responsive-text-hierarchy-e2e.md) ## Risks diff --git a/docs/plans/surface-text-hierarchy/task-04-normalize-structured-task-confirmations.md b/docs/plans/surface-text-hierarchy/task-04-normalize-structured-task-confirmations.md index 766ba76699..6b46c2f846 100644 --- a/docs/plans/surface-text-hierarchy/task-04-normalize-structured-task-confirmations.md +++ b/docs/plans/surface-text-hierarchy/task-04-normalize-structured-task-confirmations.md @@ -1,7 +1,7 @@ --- id: "04-normalize-structured-task-confirmations" title: "Normalize structured task confirmations" -status: pending +status: completed wave: 2 depends_on: - "01-standardize-surface-typography-primitives" @@ -93,4 +93,18 @@ pnpm run i18n:check ## Results -Pending implementation. +- RED: Focused assertions failed against the pre-change wrapperless fragments + and spans because the three dialogs lacked the required semantic paragraph + structure, left alignment, containment, and single description boundary. +- GREEN: Session deletion, task detachment, and environment reset now render + structured paragraphs inside one `min-w-0 text-left` AlertDialog description; + compact popover and inline descriptions remain unchanged. +- Added a shared session-delete description renderer plus focused coverage for + all three surfaces, including a 180-character dynamic task title. +- Focused verification passed with 3 test files and 11 tests. Web typecheck, + focused ESLint with `--max-warnings 0`, `pnpm run i18n:check`, targeted + Prettier, and `git diff --check` also passed on the integrated stack. +- Exact-head E2E integration exposed that the archive-only wide popover had + lost its specified pretty prose wrapping. The wide size contract now applies + `text-pretty` to its description while the default popover remains unchanged; + the shared popover and archive confirmation suites pass 20 tests.