diff --git a/docs/design-decisions.md b/docs/design-decisions.md index cbdbc86..42f1dd9 100644 --- a/docs/design-decisions.md +++ b/docs/design-decisions.md @@ -955,7 +955,7 @@ Update 2026-10-29: The native Terminal feature keeps the 65% cap on `--rs-select - Scope: The main header, the side pane, the left ribbon, the tab bars, the Settings and Browser window title bars, and the window builders of the host. - Shared implementation: `WorkbenchHeader.svelte`, `LeftPane.svelte`, `PluginRibbon.svelte`, `TabBar.svelte`, `WindowControls.svelte`, `src-tauri/src/window_frame.rs`, `src-tauri/tauri.macos.conf.json`, and the `--rs-titlebar-inset-start` token. - Evidence: `tests/smoke/layout/titleBar.smoke.mjs` and the Rust command list test. -- Replaces / replaced by: The left pane footer, and the ribbon rule "The ribbon has no width when it has no entries." +- Replaces / replaced by: The left pane footer, and the ribbon rule "The ribbon has no width when it has no entries." [UI-062](#ui-062--tabs-use-the-free-header-space) replaces the drag area rule. - Limits: Browser checks use desktop service mocks. Snap Layouts, the native drag area, and the macOS title bar need native acceptance. The macOS code path was not compiled here. On Windows 10, Win+Z does nothing. ### UI-051 — Check marks, focus rings, and control states @@ -1123,3 +1123,19 @@ Update 2026-10-29: The native Terminal feature keeps the 65% cap on `--rs-select - Evidence: `tests/smoke/menus/consistency.smoke.mjs` and `tests/smoke/features/background.smoke.mjs` check the 82% menu, the blur, and the 6% veil with an image, and opaque fills without one. `tests/unit/theme/characterPalettes.spec.ts` checks the Silver Serpent row colors on a hovered row over a white image. - Replaces: The image rule of [UI-043](#ui-043--opaque-menus). Menus without an image stay opaque. - Limits: Over the brightest image areas, dim text on a hovered row has about 15% less contrast than on the pane around it. Browser checks use desktop service mocks. Native desktop acceptance remains open. + +### UI-062 — Tabs use the free header space + +- Type: Rule change +- Date: 2026-11-02 +- Status: Implemented for user review +- Decision source: Card 7f1d29d6 ("wasted free space") reports empty header space beside tabs that scroll. +- Previous rule: [UI-050](#ui-050--global-actions-tabs-and-platform-title-bars). A drag area of 120 pixels sat after the tabs. The tabs shrank and scrolled first, so the 120 pixels stayed empty while tabs were out of view. +- New rule: The drag area fills the free space after the + button. When the tabs need more room, they use all space up to a drag area of 48 pixels. Then they scroll. Tabs keep their minimum width of 120 pixels. [Interface design](ui-design.md) holds the rule. +- Reason: Space that shows a tab is more useful than empty space. 48 pixels keep the window movable when the side pane is closed. While the side pane is open, the empty part of the header above it is also a drag area. +- Scope: The header of the main window and of detached tab windows. The header of the browser window keeps its drag area of at least 120 pixels. +- Shared implementation: `src/lib/layout/WorkbenchHeader.svelte`. +- Exceptions: None. +- Evidence: `tests/smoke/layout/titleBar.smoke.mjs` checks a drag area that fills the header with one tab, and a drag area of 48 pixels at the end of the header when 11 tabs scroll. +- Replaces / replaced by: The drag area rule of [UI-050](#ui-050--global-actions-tabs-and-platform-title-bars). +- Limits: Browser checks use desktop service mocks. The native window drag on the smaller area needs native acceptance. diff --git a/docs/ui-design.md b/docs/ui-design.md index a85c929..aeedefb 100644 --- a/docs/ui-design.md +++ b/docs/ui-design.md @@ -150,7 +150,7 @@ Decisions: [UI-002](design-decisions.md#ui-002--share-the-requested-dropdown-des - The main header holds navigation, document tabs, Save, the outline toggle, and window controls. The other tools are in the left ribbon, so the tabs keep their room. A detached tab window has no ribbon, so its header keeps those tools. - A bar at the bottom of the side pane holds the workspace switcher, Help, and Settings, as in Obsidian. The switcher names the workspace and opens the workspace list above it. - The left ribbon is always present. It holds the tools, then a line, then the plugin view shortcuts. The tools are New browser tab, Terminal, Project Management, Plug-in views, and Commands. A tool of an off feature does not show. Its menus open at its right. While the side pane is closed, the workspace switcher, Help, and Settings move to the bottom of the ribbon, so they stay reachable. -- Tabs keep a minimum width of 120 pixels and scroll. Fades show tabs out of view, and ⌄ lists all tabs. A drag area of 120 pixels sits after the tabs. In a narrow header, the tabs shrink first, and the drag area keeps at least 48 pixels. +- Tabs keep a minimum width of 120 pixels and scroll. Fades show tabs out of view, and ⌄ lists all tabs. A drag area after the tabs fills the free space of the header. The tabs use all space up to a drag area of 48 pixels before they scroll ([UI-062](design-decisions.md#ui-062--tabs-use-the-free-header-space)). - Windows and Linux title bars use square caption buttons, 46 pixels wide and full height. Rest the pointer on maximize for Snap Layouts on Windows 11. macOS keeps its native traffic lights, and title bars leave `--rs-titlebar-inset-start` free for them. - Files, Search, Bookmarks, Source control (while Git is on), and the sidebar views of installed plugins share the top navigation group. The active navigation button shows which view fills the left pane. - Plugin editor views can use the left ribbon. diff --git a/src/lib/layout/WorkbenchHeader.svelte b/src/lib/layout/WorkbenchHeader.svelte index 09e04d4..3e01761 100644 --- a/src/lib/layout/WorkbenchHeader.svelte +++ b/src/lib/layout/WorkbenchHeader.svelte @@ -115,12 +115,12 @@ :global(.shell.left-open) .header-left { width: calc(var(--ribbon-width) + var(--left) + 1px); } .header-left :global(.icon-btn), .header-right :global(.icon-btn) { flex-shrink: 0; } .header-right { justify-content: flex-end; } - /* A drag area keeps the window movable when the tabs fill the header: 120 pixels, and at least 48 in a narrow header. */ - .window-drag-space { flex: 0 1 120px; min-width: 48px; align-self: stretch; } + /* The drag area fills the free space after the tabs. It keeps 48 pixels, so the window stays movable when the tabs fill the header. */ + .window-drag-space { flex: 1 0 48px; align-self: stretch; } - /* The tab strip keeps room for one readable tab. It shrinks first, so the drag area shrinks only after it. */ + /* The tab strip uses all space up to the drag area, then scrolls. It keeps room for one readable tab. */ .header-center :global(.tabs) { - flex: 0 1000 auto; + flex: 0 1 auto; align-self: stretch; min-width: 120px; min-height: 28px; diff --git a/tests/smoke/layout/titleBar.smoke.mjs b/tests/smoke/layout/titleBar.smoke.mjs index 0fdf638..ff744f3 100644 --- a/tests/smoke/layout/titleBar.smoke.mjs +++ b/tests/smoke/layout/titleBar.smoke.mjs @@ -67,8 +67,14 @@ await runSmoke("layout/titleBar", async ({ browser }) => { await page.keyboard.press("Control+\\"); await page.locator("aside.left").waitFor(); + // With few tabs, the drag area fills the free space after the + button. + const drag = page.locator(".window-drag-space"); + await open(names[0]); + const center = await box(page.locator(".header-center")), free = await box(drag); + assert.ok(free.width > 400 && Math.abs(free.right - center.right) <= 1, JSON.stringify({ center, free })); + // Tabs keep a readable width and scroll. Fades show hidden tabs, and the list names every tab. - for (const name of names) await open(name); + for (const name of names.slice(1)) await open(name); const widths = await page.locator("header .tab").evaluateAll(tabs => tabs.map(tab => tab.getBoundingClientRect().width)); assert.ok(widths.every(width => width >= 120), JSON.stringify(widths)); const strip = page.locator("header .tabs"); @@ -93,9 +99,9 @@ await runSmoke("layout/titleBar", async ({ browser }) => { await list.waitFor({ state: "detached" }); assert.equal(await strip.evaluate(node => node.classList.contains("fade-end")), true); - // A fixed drag area follows the tabs. Caption buttons are square and fill the title bar height. - const drag = page.locator(".window-drag-space"); - assert.equal(Math.round((await box(drag)).width), 120); + // When the tabs scroll, they use all space up to a drag area of 48 pixels. Caption buttons are square and fill the title bar height. + assert.equal(Math.round((await box(drag)).width), 48); + assert.ok(Math.abs((await box(drag)).right - (await box(page.locator(".header-center"))).right) <= 1); assert.equal(await drag.getAttribute("data-tauri-drag-region"), ""); const captions = await page.locator(".window-controls .icon-btn").evaluateAll(buttons => buttons.map(button => ({ width: button.getBoundingClientRect().width, height: button.getBoundingClientRect().height, radius: getComputedStyle(button).borderRadius }))); const height = (await box(page.locator("header.header"))).height; @@ -134,5 +140,5 @@ await runSmoke("layout/titleBar", async ({ browser }) => { assert.match(await mac.getByRole("button", { name: "Settings (⌘,)", exact: true }).getAttribute("aria-label"), /⌘/); await mac.locator("header.header").screenshot({ path: `${output}/header-mac.png` }); assert.deepEqual([...page.errors, ...mac.errors], []); - console.log("PASS: bottom bar of the side pane, ribbon fallback, readable tabs with fades and a list, fixed drag area, square caption buttons, Snap Layouts request, macOS layout, both themes, narrow window."); + console.log("PASS: bottom bar of the side pane, ribbon fallback, readable tabs with fades and a list, tabs that fill the header up to the drag area, square caption buttons, Snap Layouts request, macOS layout, both themes, narrow window."); });