From 67ad43691b632de8a259785623798e71f367f241 Mon Sep 17 00:00:00 2001 From: Michael Babcock Date: Fri, 20 Nov 2026 17:20:32 -0800 Subject: [PATCH] fix(accessibility): rename Variant menu to Power The composer's reasoning-variant picker was announced as "Variant: Default". Rename its accessible name, tooltip/drawer title and the cycle command's palette entry to "Power" so screen readers announce "Power: Default". Closes #13 Co-Authored-By: Claude Opus 5.5 --- packages/app/component-tests/composer.spec.ts | 7 +++++-- packages/app/e2e/regression/mobile-model-pickers.spec.ts | 4 ++-- packages/app/src/runtime/i18n/en.ts | 4 ++-- packages/ui/src/i18n/en.ts | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/app/component-tests/composer.spec.ts b/packages/app/component-tests/composer.spec.ts index 524142f34584..d46838874068 100644 --- a/packages/app/component-tests/composer.spec.ts +++ b/packages/app/component-tests/composer.spec.ts @@ -430,7 +430,7 @@ for (const direction of ["ltr", "rtl"]) { await expect( width < 768 ? page - .getByRole("dialog", { name: "Choose model variant", exact: true }) + .getByRole("dialog", { name: "Choose power", exact: true }) .getByRole("button", { name: "high", exact: true }) : page.getByRole("menuitemradio", { name: "high", exact: true }), ).toBeVisible() @@ -774,6 +774,8 @@ story("keeps default thinking accessible by keyboard without composer hover", as // Tab through Add, Agent, and Model to the visually hidden thinking trigger. for (let count = 0; count < 4; count++) await page.keyboard.press("Tab") await expect(control).toBeFocused() + // Screen readers announce the trigger by this name with the current value. + await expect(control).toHaveAccessibleName("Power: Default") await expect(control).toHaveCSS("opacity", "1") await page.keyboard.press("Enter") await expect(control).toHaveAttribute("aria-expanded", "true") @@ -789,6 +791,7 @@ story("keeps default thinking accessible by keyboard without composer hover", as await expect(page.getByRole("menuitemradio", { name: "high", exact: true })).toBeFocused() await page.keyboard.press("Enter") await expect(control).toHaveText("high") + await expect(control).toHaveAccessibleName("Power: High") await expect(control).toBeFocused() await page.keyboard.press("Enter") await expect(page.getByRole("menuitemradio", { name: "default", exact: true })).toBeFocused() @@ -812,7 +815,7 @@ story.describe("mobile variant drawer", () => { story(`closes and restores focus when dismissed ${moment} it starts opening`, async ({ mount, page }) => { const component = await mount("opencode-composer-flow--model-and-variant") const variant = component.locator('[data-action="composer-variant"]') - const drawer = page.getByRole("dialog", { name: "Choose model variant", exact: true }) + const drawer = page.getByRole("dialog", { name: "Choose power", exact: true }) const high = drawer.getByRole("button", { name: "high", exact: true }) // Load the lazy drawer first so the dismissal below races only the drawer's own transition. diff --git a/packages/app/e2e/regression/mobile-model-pickers.spec.ts b/packages/app/e2e/regression/mobile-model-pickers.spec.ts index 6b20769d2c51..c47ba6705c55 100644 --- a/packages/app/e2e/regression/mobile-model-pickers.spec.ts +++ b/packages/app/e2e/regression/mobile-model-pickers.spec.ts @@ -16,7 +16,7 @@ for (const direction of ["ltr", "rtl"] as const) { const variant = composer.locator('[data-action="composer-variant"]') await expect(variant).toHaveText("balanced") await variant.click() - const variants = page.getByRole("dialog", { name: "Choose model variant", exact: true }) + const variants = page.getByRole("dialog", { name: "Choose power", exact: true }) await expect(variants.getByRole("button", { name: "balanced", exact: true })).toHaveAttribute( "aria-pressed", "true", @@ -341,7 +341,7 @@ test.describe("touch composer pickers", () => { const composer = page.locator('[data-component="composer"]') const variant = composer.locator('[data-action="composer-variant"]') await variant.tap() - const variants = page.getByRole("dialog", { name: "Choose model variant", exact: true }) + const variants = page.getByRole("dialog", { name: "Choose power", exact: true }) await variants.getByRole("button", { name: "default", exact: true }).tap() await expect(variants).toBeHidden() await expect(variant).toHaveText("default") diff --git a/packages/app/src/runtime/i18n/en.ts b/packages/app/src/runtime/i18n/en.ts index 288e1cbae8c4..379eb4e42adc 100644 --- a/packages/app/src/runtime/i18n/en.ts +++ b/packages/app/src/runtime/i18n/en.ts @@ -144,8 +144,8 @@ export const dict = { "command.agent.cycle.description": "Switch to the next agent", "command.agent.cycle.reverse": "Cycle agent backwards", "command.agent.cycle.reverse.description": "Switch to the previous agent", - "command.model.variant.cycle": "Cycle model variant", - "command.model.variant.cycle.description": "Switch to the next model variant", + "command.model.variant.cycle": "Cycle power", + "command.model.variant.cycle.description": "Switch to the next power level", "command.prompt.mode.shell": "Shell", "command.prompt.mode.normal": "Prompt", "command.prompt.mode.toggle": "Toggle shell mode", diff --git a/packages/ui/src/i18n/en.ts b/packages/ui/src/i18n/en.ts index a642d48a7e4b..b12c289cb394 100644 --- a/packages/ui/src/i18n/en.ts +++ b/packages/ui/src/i18n/en.ts @@ -245,9 +245,9 @@ const source = { "ui.promptInput.shell": "Shell command", "ui.promptInput.chooseAgent": "Choose agent", "ui.promptInput.chooseModel": "Choose model", - "ui.promptInput.chooseVariant": "Choose model variant", + "ui.promptInput.chooseVariant": "Choose power", "ui.promptInput.agentCurrent": "Agent: {{agent}}", - "ui.promptInput.variantCurrent": "Variant: {{variant}}", + "ui.promptInput.variantCurrent": "Power: {{variant}}", "ui.promptInput.send": "Send", "ui.promptInput.stop": "Stop", "ui.promptInput.exitShell": "Exit",