fix(webui): restore keyboard focus after pointer use (#6735)

* fix(webui): restore focus rings for file and image shortcuts

* test(webui): wait for the welcome composer before opening model options
This commit is contained in:
chengyongru authored and GitHub committed 2026-11-20 16:12:24 +08:00
1 parent 341fd37c0c
commit 3e9024ea04
6 files changed
+34 -5

No files matched your search

+9 -1
View File
@@ -187,9 +187,17 @@ test("image lightbox and file download remain keyboard accessible", async ({ pag
await page.keyboard.press("ArrowRight");
await expect(page.getByRole("dialog", { name: "Blue study.svg" })).toBeVisible();
await page.keyboard.press("End");
await expect(page.getByRole("dialog", { name: "Green study.svg" })).toBeVisible();
const lightbox = page.getByRole("dialog", { name: "Green study.svg" });
await expect(lightbox).toBeVisible();
await page.screenshot({ path: testInfo.outputPath("lightbox.png") });
await testInfo.attach("image lightbox", { path: testInfo.outputPath("lightbox.png"), contentType: "image/png" });
const viewport = lightbox.getByTestId("image-zoom-viewport");
await viewport.click();
await expect(viewport).toHaveCSS("box-shadow", "none");
await page.keyboard.press("=");
await expect(lightbox.getByRole("button", { name: "Fit image" })).toHaveText("150%");
await expect(viewport).toBeFocused();
await expect(viewport).not.toHaveCSS("box-shadow", "none");
await page.keyboard.press("Escape");
await expect(page.getByRole("dialog")).toHaveCount(0);
await expect(firstImage).toBeFocused();
+12 -2
View File
@@ -49,9 +49,19 @@ test("inferred files wrap without losing copy text or preview actions", async ({
await files.nth(1).click();
await expect(page.getByLabel("Opened file")).toHaveText(`notes/${"long directory/".repeat(16)}report.md`);
await files.first().press("Enter");
const first = files.first();
await first.press("Enter");
await expect(page.getByLabel("Opened file")).toHaveText("notes/ready.md");
await files.first().press("Shift+F10");
await first.click();
await expect(first).toHaveCSS("box-shadow", "none");
await page.keyboard.press("Shift+F10");
const copyMenu = page.getByRole("menu");
await expect(copyMenu).toBeVisible();
await page.keyboard.press("Escape");
await expect(first).toBeFocused();
await expect(first).not.toHaveCSS("box-shadow", "none");
await page.keyboard.press("Shift+F10");
await page.getByRole("menuitem", { name: "Copy absolute path", exact: true }).click();
expect(await page.evaluate(() => navigator.clipboard.readText())).toBe("notes/ready.md");
await files.nth(6).hover();
+3 -1
View File
@@ -258,7 +258,9 @@ for (const { width, height, theme } of [
test(`selects a custom preset's reasoning effort in the themed picker at ${width}px`, async ({ page }, testInfo) => {
await page.setViewportSize({ width, height });
await page.goto(`/browser/fixture.html?case=model-options&group=local&${theme}`);
await page.getByRole("button", { name: "Default", exact: true }).click();
// Loading an empty thread moves the composer into the welcome layout.
const welcome = page.getByTestId("thread-welcome-layout");
await welcome.getByRole("button", { name: "Default", exact: true }).click();
const dialog = page.getByRole("dialog", { name: "Switch model", exact: true });
await dialog.getByRole("option", { name: "Custom API", exact: true }).click();
await page.getByRole("button", { name: "Custom API", exact: true }).click();