From e19bf6f43fb6d23cfc833ea1ce0764080ac7bc64 Mon Sep 17 00:00:00 2001 From: Zakk Date: Tue, 29 Sep 2026 18:49:37 +1000 Subject: [PATCH] fix(ui): keep the tab bar as wide as its tabs --- e2e/tab-switch.spec.ts | 9 +++++++++ src/ui/styles/tabs-panels.css | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/e2e/tab-switch.spec.ts b/e2e/tab-switch.spec.ts index 867183e1..b8578741 100644 --- a/e2e/tab-switch.spec.ts +++ b/e2e/tab-switch.spec.ts @@ -82,3 +82,12 @@ for (const path of ['dns?tab=cache', 'dns?tab=log', 'nodes?tab=list', 'flows?tab test(`${path}: a table comes back from another tab at its final column widths`, async ({page}) => { await switchBack(page, path); }); + +// The bar is as wide as its tabs, not the row the panels share. +test('a tab bar keeps the width of its tabs', async ({page}) => { + await page.goto('/#/dns?tab=stats'); + const bar = page.locator('.rp-tabbar').first(); + await expect(bar).toBeVisible(); + const [barWidth, rowWidth] = await bar.evaluate(el => [el.getBoundingClientRect().width, el.parentElement!.getBoundingClientRect().width]); + expect(barWidth).toBeLessThan(rowWidth / 2); +}); diff --git a/src/ui/styles/tabs-panels.css b/src/ui/styles/tabs-panels.css index 43f2f976..e79f95e3 100644 --- a/src/ui/styles/tabs-panels.css +++ b/src/ui/styles/tabs-panels.css @@ -9,7 +9,8 @@ .rp-tabbar { position: relative; display: inline-flex; - align-self: flex-start; + /* A grid item: justify-self keeps the bar as wide as its tabs instead of the row. */ + justify-self: start; max-width: 100%; /* More tabs than a phone is wide scroll within the bar, not the page; the slider scrolls with them. */ overflow-x: auto;