diff --git a/docs/guide/workspace.md b/docs/guide/workspace.md index 7791604d4d..2ac1bba70b 100644 --- a/docs/guide/workspace.md +++ b/docs/guide/workspace.md @@ -30,6 +30,11 @@ Dismissing the drawer returns keyboard focus to the control that opened it. The Agents gallery header wraps to the available width so its import and create actions remain visible beside the compact sidebar on narrow screens. +Screen readers announce the main chat button as **Send** when composing a +message and **Stop current task** while a response is streaming, in the +workspace language. Use the separate **Send update** button to queue or steer +a running task when those controls are available. + ## Search conversations and messages Use **Search** in the sidebar or **⌘K / Ctrl+K** to find conversation titles and diff --git a/frontend/src/components/workspace/input-box.tsx b/frontend/src/components/workspace/input-box.tsx index baf1a42849..819aa0fb1b 100644 --- a/frontend/src/components/workspace/input-box.tsx +++ b/frontend/src/components/workspace/input-box.tsx @@ -2161,6 +2161,13 @@ export function InputBox({ // the stop affordance (gated above), so the send denial only applies to // the send state. const sendDenied = status !== "streaming" && !canCreateRuns; + const submitTitle = stopDenied + ? t.inputBox.stopStreamingUnavailable + : sendDenied + ? t.inputBox.startTurnUnavailable + : status === "streaming" + ? t.inputBox.stopRun + : undefined; const inputPolishUndoAvailable = !polishingInput && inputPolishUndo !== null && @@ -3579,29 +3586,8 @@ export function InputBox({ } variant="outline" status={status} - {...(status === "streaming" && canSendBusyInput - ? { - "aria-label": t.inputBox.stopRun, - title: t.inputBox.stopRun, - } - : {})} - // A bare disabled square reads as a broken composer; explain - // the permission boundary (native title, since a Radix - // tooltip won't fire on a disabled button). Spread - // conditionally: an explicitly-undefined aria-label would - // clobber PromptInputSubmit's default aria-label="Submit" - // and strip the submit control's accessible name. - {...(stopDenied - ? { - "aria-label": t.inputBox.stopStreamingUnavailable, - title: t.inputBox.stopStreamingUnavailable, - } - : sendDenied - ? { - "aria-label": t.inputBox.startTurnUnavailable, - title: t.inputBox.startTurnUnavailable, - } - : {})} + aria-label={submitTitle ?? t.inputBox.send} + title={submitTitle} onClick={(e) => { if (status === "streaming") { e.preventDefault(); diff --git a/frontend/src/core/i18n/locales/en-US.ts b/frontend/src/core/i18n/locales/en-US.ts index 51318422b4..0afff02663 100644 --- a/frontend/src/core/i18n/locales/en-US.ts +++ b/frontend/src/core/i18n/locales/en-US.ts @@ -804,6 +804,7 @@ export const enUS: Translations = { }, ], pleaseWaitStreaming: "Please wait for the current response to finish.", + send: "Send", runInputMode: "Send while working", queueMode: "Queue", steerMode: "Steer", diff --git a/frontend/src/core/i18n/locales/types.ts b/frontend/src/core/i18n/locales/types.ts index 595c64e60f..c6ded5a9c8 100644 --- a/frontend/src/core/i18n/locales/types.ts +++ b/frontend/src/core/i18n/locales/types.ts @@ -654,6 +654,7 @@ export interface Translations { } )[]; pleaseWaitStreaming: string; + send: string; runInputMode: string; queueMode: string; steerMode: string; diff --git a/frontend/src/core/i18n/locales/zh-CN.ts b/frontend/src/core/i18n/locales/zh-CN.ts index 14b1712442..c9d896febb 100644 --- a/frontend/src/core/i18n/locales/zh-CN.ts +++ b/frontend/src/core/i18n/locales/zh-CN.ts @@ -755,6 +755,7 @@ export const zhCN: Translations = { }, ], pleaseWaitStreaming: "请等待当前响应完成。", + send: "发送", runInputMode: "运行中发送方式", queueMode: "排队执行", steerMode: "调整当前任务", diff --git a/frontend/tests/e2e/agent-knowledge-binding.spec.ts b/frontend/tests/e2e/agent-knowledge-binding.spec.ts index dfd02818ce..dbcd43d12e 100644 --- a/frontend/tests/e2e/agent-knowledge-binding.spec.ts +++ b/frontend/tests/e2e/agent-knowledge-binding.spec.ts @@ -89,7 +89,7 @@ for (const width of [1280, 390]) { await page .getByPlaceholder(/how can i assist you/i) .fill("Find the leave policy"); - await page.getByRole("button", { name: "Submit" }).click(); + await page.getByRole("button", { name: "Send", exact: true }).click(); await expect.poll(() => submitted).toBeDefined(); expect(submitted).toMatchObject({ assistant_id: "researcher", @@ -116,7 +116,7 @@ for (const width of [1280, 390]) { await page .getByPlaceholder(/how can i assist you/i) .fill("Do not search knowledge"); - await page.getByRole("button", { name: "Submit" }).click(); + await page.getByRole("button", { name: "Send", exact: true }).click(); await expect.poll(() => submitted).toBeDefined(); expect(submitted).toMatchObject({ input: { diff --git a/frontend/tests/e2e/artifact-selection.spec.ts b/frontend/tests/e2e/artifact-selection.spec.ts index 13e4f669ce..1926435494 100644 --- a/frontend/tests/e2e/artifact-selection.spec.ts +++ b/frontend/tests/e2e/artifact-selection.spec.ts @@ -129,7 +129,7 @@ test("artifact quotes retain the selected source line in the conversation", asyn return handleRunStream(route); }); await composer.fill("Explain this figure"); - await form.getByRole("button", { name: "Submit", exact: true }).click(); + await form.getByRole("button", { name: "Send", exact: true }).click(); await expect .poll(() => JSON.stringify(submitted)) .toContain(`${filepath}:L5-L5`); diff --git a/frontend/tests/e2e/file-transfer.spec.ts b/frontend/tests/e2e/file-transfer.spec.ts index 102e8eebc3..47e3fd6a61 100644 --- a/frontend/tests/e2e/file-transfer.spec.ts +++ b/frontend/tests/e2e/file-transfer.spec.ts @@ -162,7 +162,7 @@ test("uploads retain successful files, cancel one file and retry only the failed await page .locator('textarea[name="message"]') .fill("Review these attachments"); - await prompt.getByRole("button", { name: "Submit", exact: true }).click(); + await prompt.getByRole("button", { name: "Send", exact: true }).click(); await expect.poll(() => attempts.length).toBe(3); await expect(prompt.getByRole("status")).toHaveText([ "Uploaded", @@ -216,7 +216,7 @@ test("uploads retain successful files, cancel one file and retry only the failed path: path.join(qa, "uploads-recovered-light.png"), animations: "disabled", }); - await prompt.getByRole("button", { name: "Submit", exact: true }).click(); + await prompt.getByRole("button", { name: "Send", exact: true }).click(); await expect.poll(() => sends).toBe(1); await expect(prompt.getByTitle("success.txt", { exact: true })).toHaveCount( 0, diff --git a/frontend/tests/e2e/knowledge-scope.spec.ts b/frontend/tests/e2e/knowledge-scope.spec.ts index 6e176aa410..43d03b904c 100644 --- a/frontend/tests/e2e/knowledge-scope.spec.ts +++ b/frontend/tests/e2e/knowledge-scope.spec.ts @@ -81,7 +81,7 @@ test.describe("custom-agent knowledge scope", () => { await page .getByPlaceholder(/how can i assist you/i) .fill("Find the policy"); - await page.getByRole("button", { name: "Submit" }).click(); + await page.getByRole("button", { name: "Send", exact: true }).click(); await expect.poll(() => streamBody).toBeDefined(); expect(streamBody).toMatchObject({ @@ -170,7 +170,7 @@ test.describe("custom-agent knowledge scope", () => { await page .getByPlaceholder(/how can i assist you/i) .fill("Find the policy"); - await page.getByRole("button", { name: "Submit" }).click(); + await page.getByRole("button", { name: "Send", exact: true }).click(); await expect.poll(() => streamBody).toBeDefined(); expect(streamBody).toMatchObject({ diff --git a/frontend/tests/e2e/mentions.spec.ts b/frontend/tests/e2e/mentions.spec.ts index 93b9580f7a..a85e8ae754 100644 --- a/frontend/tests/e2e/mentions.spec.ts +++ b/frontend/tests/e2e/mentions.spec.ts @@ -360,7 +360,7 @@ for (const enabledAfterRetry of [true, false]) { await expect(retry).toBeVisible(); await expect(page.getByTestId("conversation-reference-chip")).toBeVisible(); await expect( - page.getByRole("button", { name: "Submit", exact: true }), + page.getByRole("button", { name: "Send", exact: true }), ).toBeDisabled(); await input.press("End"); await input.pressSequentially("after retry"); @@ -382,7 +382,7 @@ for (const enabledAfterRetry of [true, false]) { await retry.click(); await expect(retry).toBeHidden(); await expect( - page.getByRole("button", { name: "Submit", exact: true }), + page.getByRole("button", { name: "Send", exact: true }), ).toBeEnabled(); if (enabledAfterRetry) await expect( diff --git a/frontend/tests/e2e/sidecar-chat.spec.ts b/frontend/tests/e2e/sidecar-chat.spec.ts index e6a006c9ee..075ec5ab4c 100644 --- a/frontend/tests/e2e/sidecar-chat.spec.ts +++ b/frontend/tests/e2e/sidecar-chat.spec.ts @@ -162,10 +162,7 @@ async function expectComposerHeightsEqual(page: Page) { async function expectSidecarModelPinnedToSubmit(page: Page) { const metrics = await page.evaluate(() => { - const getComposerMetrics = ( - placeholderPattern: RegExp, - submitLabel: string, - ) => { + const getComposerMetrics = (placeholderPattern: RegExp) => { const textarea = Array.from(document.querySelectorAll("textarea")).find( (element) => placeholderPattern.test(element.getAttribute("placeholder") ?? ""), @@ -189,7 +186,7 @@ async function expectSidecarModelPinnedToSubmit(page: Page) { const model = buttons.find( (button) => button.label === "DeepSeek V4 Pro", ); - const submit = buttons.find((button) => button.label === submitLabel); + const submit = buttons.find((button) => button.label === "Send"); return { formLeft: Math.round(formBox.left), @@ -207,8 +204,8 @@ async function expectSidecarModelPinnedToSubmit(page: Page) { }; return { - main: getComposerMetrics(/how can i assist you/i, "Submit"), - sidecar: getComposerMetrics(/deeper follow-up/i, "Send"), + main: getComposerMetrics(/how can i assist you/i), + sidecar: getComposerMetrics(/deeper follow-up/i), }; }); diff --git a/frontend/tests/e2e/tool-approval.spec.ts b/frontend/tests/e2e/tool-approval.spec.ts index d2dda94447..385944d689 100644 --- a/frontend/tests/e2e/tool-approval.spec.ts +++ b/frontend/tests/e2e/tool-approval.spec.ts @@ -41,7 +41,7 @@ test("approval mode is independent of reasoning and is sent with the run", async await page .getByPlaceholder(/how can i assist you/i) .fill("Inspect the project"); - await page.getByRole("button", { name: "Submit", exact: true }).click(); + await page.getByRole("button", { name: "Send", exact: true }).click(); await expect .poll(() => body) .toMatchObject({ context: { tool_approval_mode: "auto" } }); diff --git a/frontend/tests/e2e/voice-input.spec.ts b/frontend/tests/e2e/voice-input.spec.ts index 586d605ee8..a1f71868b1 100644 --- a/frontend/tests/e2e/voice-input.spec.ts +++ b/frontend/tests/e2e/voice-input.spec.ts @@ -127,7 +127,7 @@ test("records beside Send, uploads real audio once, then polishes the transcript await expect(input).toHaveValue("Task:"); await expect(page.getByTestId("polish-input-button")).toBeDisabled(); await expect( - page.getByRole("button", { name: "Submit", exact: true }), + page.getByRole("button", { name: "Send", exact: true }), ).toBeDisabled(); await input.press("Enter"); await expect(input).toHaveValue("Task: research energy storage"); @@ -143,7 +143,7 @@ test("records beside Send, uploads real audio once, then polishes the transcript await expect(input).toHaveValue("Task: research energy storage"); const micBox = (await page.getByTestId("voice-input-button").boundingBox())!; const sendBox = (await page - .getByRole("button", { name: "Submit", exact: true }) + .getByRole("button", { name: "Send", exact: true }) .boundingBox())!; expect(micBox.x + micBox.width).toBeLessThanOrEqual(sendBox.x); expect(sendBox.x - micBox.x).toBeLessThan(65); diff --git a/frontend/tests/e2e/workspace-search-review.spec.ts b/frontend/tests/e2e/workspace-search-review.spec.ts index 19c9ad9763..355ec223fa 100644 --- a/frontend/tests/e2e/workspace-search-review.spec.ts +++ b/frontend/tests/e2e/workspace-search-review.spec.ts @@ -73,7 +73,7 @@ for (const agentName of [undefined, "researcher"]) { await composer.press("Enter"); await (await first).finished(); await expect( - page.getByRole("button", { name: "Submit", exact: true }), + page.getByRole("button", { name: "Send", exact: true }), ).toBeEnabled(); await page.keyboard.press("ControlOrMeta+k"); const dialog = page.getByRole("dialog", { name: "Search conversations" }); diff --git a/frontend/tests/unit/components/workspace/input-box-mentions.dom.test.tsx b/frontend/tests/unit/components/workspace/input-box-mentions.dom.test.tsx index dc4fd6ab62..1928b13437 100644 --- a/frontend/tests/unit/components/workspace/input-box-mentions.dom.test.tsx +++ b/frontend/tests/unit/components/workspace/input-box-mentions.dom.test.tsx @@ -1078,7 +1078,7 @@ it("keeps cancellation available while approvals lock new input", async () => { }); expect(screen.getByRole("textbox").disabled).toBe(true); const submit = screen.getByRole("button", { - name: "Submit", + name: "Stop current task", }); expect(submit.disabled).toBe(false); fireEvent.click(submit); diff --git a/frontend/tests/unit/components/workspace/input-box-send-gating.dom.test.tsx b/frontend/tests/unit/components/workspace/input-box-send-gating.dom.test.tsx index c47d5fed9c..4e3457142e 100644 --- a/frontend/tests/unit/components/workspace/input-box-send-gating.dom.test.tsx +++ b/frontend/tests/unit/components/workspace/input-box-send-gating.dom.test.tsx @@ -295,14 +295,19 @@ describe("InputBox send gating (runs:create)", () => { await waitFor(() => expect(onSubmit).toHaveBeenCalledTimes(1)); }); - it("keeps the base Submit accessible name when send is not denied", () => { - // Mirror of the stop-gating regression: the aria-label must be spread - // conditionally, never explicitly-undefined, or it clobbers - // PromptInputSubmit's default aria-label="Submit". - renderComposer({ onSubmit: rs.fn() }); - - const submit = screen.getByRole("button", { name: "Submit" }); - expect(submit.tagName).toBe("BUTTON"); + it.each([ + ["en-US", "Send"], + ["zh-CN", "发送"], + ] as const)("names the send action in %s", (locale, name) => { + document.cookie = `locale=${locale}; path=/`; + try { + const { container } = renderComposer({ onSubmit: rs.fn(), locale }); + expect(screen.getByRole("button", { name })).toBe( + getSubmitButton(container), + ); + } finally { + document.cookie = "locale=; max-age=0; path=/"; + } }); }); diff --git a/frontend/tests/unit/components/workspace/input-box-stop-gating.dom.test.tsx b/frontend/tests/unit/components/workspace/input-box-stop-gating.dom.test.tsx index 0527ff66b7..08f352fc42 100644 --- a/frontend/tests/unit/components/workspace/input-box-stop-gating.dom.test.tsx +++ b/frontend/tests/unit/components/workspace/input-box-stop-gating.dom.test.tsx @@ -160,27 +160,14 @@ describe("InputBox stop gating (runs:cancel)", () => { it("keeps stop enabled for an unresolved permission list (default)", () => { const onStop = rs.fn(); - const { container } = renderComposer({ onStop }); + renderComposer({ onStop }); - const submit = getSubmitButton(container); - expect(submit.disabled).toBe(false); + const stop = screen.getByRole("button", { + name: "Stop current task", + }); + expect(stop.disabled).toBe(false); - fireEvent.click(submit); + fireEvent.click(stop); expect(onStop).toHaveBeenCalledTimes(1); }); - - it("keeps the base Submit accessible name when stop is not denied", () => { - // Regression: passing an explicitly-undefined aria-label clobbered - // PromptInputSubmit's default aria-label="Submit" via JSX spread, - // stripping the submit control's accessible name in every - // non-denied state (e2e locates the button by that name). Query by - // role + name so the assertion resolves the accessible name the - // same way e2e and assistive tech do, not via the raw attribute. - renderComposer({ onStop: rs.fn() }); - - // getByRole throws when no button exposes the "Submit" accessible - // name, which is exactly the regression being guarded. - const submit = screen.getByRole("button", { name: "Submit" }); - expect(submit.tagName).toBe("BUTTON"); - }); });