Keep workspace focus mode scoped and easy to exit (#2151)

* fix(workspace): keep focus mode scoped and easy to exit

Route focus mode through the active workspace so persisted state cannot hide chrome on settings or other screens. Add a visible exit control and keep desktop window chrome aligned and visually quiet.

* fix(app): clarify muted chrome semantics
This commit is contained in:
Mohamed Boudra
2026-07-16 23:46:24 +02:00
committed by GitHub
parent d2308f4835
commit a622860a3e
25 changed files with 261 additions and 30 deletions

View File

@@ -0,0 +1,51 @@
import { expect, test } from "./fixtures";
const modifier = process.platform === "darwin" ? "Meta" : "Control";
async function pressFocusModeShortcut(page: import("@playwright/test").Page) {
await page.keyboard.press(`${modifier}+Shift+F`);
}
async function pressSettingsShortcut(page: import("@playwright/test").Page) {
await page.keyboard.press(`${modifier}+Comma`);
}
async function blurActiveElement(page: import("@playwright/test").Page) {
await page.evaluate(() => (document.activeElement as HTMLElement | null)?.blur());
}
test("focus mode only applies to the active workspace screen", async ({ page, withWorkspace }) => {
const workspace = await withWorkspace({ prefix: "focus-mode-boundary-" });
await workspace.navigateTo();
const exitFocusMode = page.getByRole("button", { name: "Exit focus mode" });
const settingsButton = page.getByRole("button", { name: "Settings", exact: true });
const settingsSidebar = page.getByRole("navigation", { name: "Settings" });
await expect(settingsButton).toBeVisible();
await expect(exitFocusMode).toHaveCount(0);
await blurActiveElement(page);
await pressFocusModeShortcut(page);
await expect(exitFocusMode).toBeVisible();
await expect(settingsButton).toHaveCount(0);
const workspaceUrl = page.url();
await pressSettingsShortcut(page);
await expect(settingsSidebar).toBeVisible();
await expect(exitFocusMode).toHaveCount(0);
await page.reload();
await expect(settingsSidebar).toBeVisible();
await expect(exitFocusMode).toHaveCount(0);
await pressFocusModeShortcut(page);
await page.goto(workspaceUrl);
await expect(exitFocusMode).toBeVisible();
await exitFocusMode.click();
await expect(exitFocusMode).toHaveCount(0);
await expect(settingsButton).toBeVisible();
});