From 7e04670461e763b578a3174ff1852309b8819300 Mon Sep 17 00:00:00 2001 From: chengyongru <61816729+chengyongru@users.noreply.github.com> Date: Wed, 18 Nov 2026 16:44:27 +0800 Subject: [PATCH] fix(webui): round Codex speed controls to match the reasoning slider (#6703) --- webui/browser/model-options.spec.ts | 22 ++++++++++++++++--- .../src/components/ui/codex-speed-control.tsx | 14 ++++++------ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/webui/browser/model-options.spec.ts b/webui/browser/model-options.spec.ts index ea5e8f131..519215de3 100644 --- a/webui/browser/model-options.spec.ts +++ b/webui/browser/model-options.spec.ts @@ -1,4 +1,15 @@ -import { expect, test } from "@playwright/test"; +import { expect, test, type Locator } from "@playwright/test"; + +async function expectSpeedCircle(button: Locator, track: { y: number; height: number }) { + const face = button.locator(":scope > [aria-hidden]"); + await expect(face).toHaveCSS("corner-shape", /^(round|superellipse\(1\))$/); + const { y, width, height } = (await face.boundingBox())!; + expect(height).toBe(track.height); + expect(width).toBe(height); + expect(y).toBeCloseTo(track.y, 0); + expect(await face.evaluate((element) => Number.parseFloat(getComputedStyle(element).borderTopLeftRadius))).toBeGreaterThanOrEqual(height / 2); + await expect(button).toHaveCSS("background-color", "rgba(0, 0, 0, 0)"); +} for (const width of [390, 1280]) { test(`current-chat model options preserve the compact preset menu at ${width}px`, async ({ page }, testInfo) => { @@ -29,6 +40,7 @@ for (const width of [390, 1280]) { const thumb = (await dialog.locator(".reasoning-effort-thumb").boundingBox())!; expect(track.height).toBe(20); expect(thumb.height).toBe(24); + await expectSpeedCircle(fast, track); const stops = await dialog.locator(".reasoning-effort-tick").evaluateAll((elements) => elements.map((element) => element.getBoundingClientRect().x), ); @@ -84,9 +96,9 @@ test("Temporary Chats do not expose model option controls", async ({ page }) => await expect(page.getByRole("button", { name: "Fast", exact: true })).toHaveCount(0); }); -test("reselecting medium and choosing Ultrafast sends and remembers both concrete values", async ({ page }) => { +test("reselecting medium and choosing Ultrafast sends and remembers both concrete values", async ({ page }, testInfo) => { await page.setViewportSize({ width: 320, height: 800 }); - await page.goto("/browser/fixture.html?case=model-options&ultrafast"); + await page.goto("/browser/fixture.html?case=model-options&ultrafast&dark"); const open = page.getByRole("button", { name: "Default", exact: true }); await open.click(); const dialog = page.getByRole("dialog", { name: "Switch model", exact: true }); @@ -134,9 +146,13 @@ test("reselecting medium and choosing Ultrafast sends and remembers both concret await ultrafast.click(); await expect(ultrafast).toHaveAttribute("aria-pressed", "true"); await expect(fast).toHaveAttribute("aria-pressed", "false"); + const track = (await dialog.locator(".reasoning-effort-track").boundingBox())!; + await expectSpeedCircle(fast, track); + await expectSpeedCircle(ultrafast, track); expect(await speeds.evaluate((group) => [...group.querySelectorAll("button")].every((button) => button.scrollWidth <= button.clientWidth + 1 && button.offsetWidth >= 44 && button.offsetHeight >= 44, ))).toBe(true); + await dialog.locator(".model-options-row").screenshot({ path: testInfo.outputPath("model-options-ultrafast-320.png") }); await dialog.press("Escape"); await page.getByLabel("Message input").fill("Test this speed"); await page.getByRole("button", { name: "Send message", exact: true }).click(); diff --git a/webui/src/components/ui/codex-speed-control.tsx b/webui/src/components/ui/codex-speed-control.tsx index 8682f031d..940189098 100644 --- a/webui/src/components/ui/codex-speed-control.tsx +++ b/webui/src/components/ui/codex-speed-control.tsx @@ -29,19 +29,19 @@ export function CodexSpeedControl({ value, onChange, ultrafastSupported }: { size="sm" aria-label={label} aria-pressed={selected} - className="group/speed h-8 w-8 rounded-lg p-0 max-sm:h-11 max-sm:w-11" + className="group/speed size-8 rounded-full p-0 hover:bg-transparent active:bg-transparent aria-pressed:bg-transparent max-sm:size-11" onClick={() => onChange(selected ? false : mode)} > {ultra ? ( - - - + + + - ) : } + ) : }