Use the free header space for tabs

The drag area after the tabs kept 120 pixels. The tabs shrank and
scrolled first, so the 120 pixels stayed empty while tabs were out of
view.

- 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.
- UI-062 records the rule change, and the interface design guide holds
  the new rule.

The titleBar smoke test checks the drag area with one tab and with 11
tabs. Card 7f1d29d6.
This commit is contained in:
Knotty Wyvern
2026-11-03 00:23:17 -07:00
parent 5557443ed1
commit 0ab7fe0c64
4 changed files with 33 additions and 11 deletions
+11 -5
View File
@@ -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.");
});