diff --git a/apps/web/components/task/chat/auto-scroll-toggle-button.test.tsx b/apps/web/components/task/chat/auto-scroll-toggle-button.test.tsx index f9ff962de5..7c47ef94c1 100644 --- a/apps/web/components/task/chat/auto-scroll-toggle-button.test.tsx +++ b/apps/web/components/task/chat/auto-scroll-toggle-button.test.tsx @@ -49,6 +49,13 @@ describe("AutoScrollToggleButton", () => { expect(button.getAttribute("aria-label")).toMatch(/turn off/i); }); + it("shows the icon in dark green, maximized to fill its box, when enabled", () => { + renderButton("session-a"); + const icon = screen.getByTestId("auto-scroll-toggle-icon"); + expect(icon.getAttribute("class")).toMatch(/text-green-600/); + expect(icon.getAttribute("class")).toMatch(/h-6 w-6/); + }); + it("clicking while enabled disables auto-scroll for the session", () => { renderButton("session-a"); fireEvent.click(getButton()); @@ -63,6 +70,13 @@ describe("AutoScrollToggleButton", () => { expect(button.getAttribute("aria-label")).toMatch(/turn on/i); }); + it("shows the icon with no color when disabled", () => { + enabledBySessionId = { "session-a": false }; + renderButton("session-a"); + const icon = screen.getByTestId("auto-scroll-toggle-icon"); + expect(icon.getAttribute("class")).not.toMatch(/text-green-600/); + }); + it("clicking while disabled re-enables auto-scroll for the session", () => { enabledBySessionId = { "session-a": false }; renderButton("session-a"); diff --git a/apps/web/components/task/chat/auto-scroll-toggle-button.tsx b/apps/web/components/task/chat/auto-scroll-toggle-button.tsx index dfaf247a75..a029548de2 100644 --- a/apps/web/components/task/chat/auto-scroll-toggle-button.tsx +++ b/apps/web/components/task/chat/auto-scroll-toggle-button.tsx @@ -1,9 +1,10 @@ "use client"; -import { IconArrowBarToDown, IconArrowBarToDownDashed } from "@tabler/icons-react"; +import { IconArrowBarToDown } from "@tabler/icons-react"; import { Button } from "@kandev/ui/button"; import { Tooltip, TooltipContent, TooltipTrigger } from "@kandev/ui/tooltip"; +import { cn } from "@/lib/utils"; import { useAppStore } from "@/components/state-provider"; import { useTranscriptAutoScrollEnabled } from "./use-transcript-auto-scroll-enabled"; @@ -23,6 +24,10 @@ type Props = { * auto-scroll and catches the view up if the transcript progressed while * disabled. See message-list-native.tsx / message-list-virtuoso.tsx for the * renderer-side behavior driven by this preference. + * + * The icon renders dark green while enabled and reverts to the default + * muted color when disabled — the color swap alone carries the on/off + * signal. */ export function AutoScrollToggleButton({ sessionId }: Props) { const showControl = useAppStore((state) => state.userSettings.showTranscriptAutoScrollControl); @@ -46,11 +51,10 @@ export function AutoScrollToggleButton({ sessionId }: Props) { aria-pressed={enabled} data-testid="auto-scroll-toggle-button" > - {enabled ? ( - - ) : ( - - )} + {label} diff --git a/apps/web/e2e/tests/chat/auto-scroll-toggle.spec.ts b/apps/web/e2e/tests/chat/auto-scroll-toggle.spec.ts index a8258acd8b..ff3ca1b515 100644 --- a/apps/web/e2e/tests/chat/auto-scroll-toggle.spec.ts +++ b/apps/web/e2e/tests/chat/auto-scroll-toggle.spec.ts @@ -99,6 +99,9 @@ test.describe("Transcript auto-scroll toggle", () => { await expect(toggle).toBeVisible({ timeout: 10_000 }); await expect(toggle).toHaveAttribute("aria-pressed", "true"); + const icon = toggle.getByTestId("auto-scroll-toggle-icon"); + await expect(icon).toHaveClass(/text-green-600/); + // Sits immediately to the left of Share within the same right-aligned cluster. const shareButton = statusBar.getByTestId("share-task-button"); if (await shareButton.isVisible()) { @@ -113,9 +116,11 @@ test.describe("Transcript auto-scroll toggle", () => { await toggle.click(); await expect(toggle).toHaveAttribute("aria-pressed", "false"); + await expect(icon).not.toHaveClass(/text-green-600/); await toggle.click(); await expect(toggle).toHaveAttribute("aria-pressed", "true"); + await expect(icon).toHaveClass(/text-green-600/); }); test("disabling freezes the position and suppresses auto-scroll for new messages", async ({ diff --git a/docs/pr-screenshots/2073-auto-scroll-toggle-disabled.png b/docs/pr-screenshots/2073-auto-scroll-toggle-disabled.png new file mode 100644 index 0000000000..f3082f72fb Binary files /dev/null and b/docs/pr-screenshots/2073-auto-scroll-toggle-disabled.png differ diff --git a/docs/pr-screenshots/2073-auto-scroll-toggle-enabled.png b/docs/pr-screenshots/2073-auto-scroll-toggle-enabled.png new file mode 100644 index 0000000000..18604ace0f Binary files /dev/null and b/docs/pr-screenshots/2073-auto-scroll-toggle-enabled.png differ