From 4b8cfd30eeaafbbaf124b4b46f5aaa1d08c27372 Mon Sep 17 00:00:00 2001 From: Zakk Date: Sun, 4 Oct 2026 20:05:41 +1100 Subject: [PATCH] fix(widgets): give the edge handle room around its summary The light sits in a control-wide square as in the panel header, so the gap to the rates matches the header, and the handle adds the control's inline padding after the rates, keeping them clear of the screen edge. --- changes/fix-pinned-panel-locked.md | 1 + e2e/widgets.spec.ts | 31 ++++++++++++++++++++++++++++-- src/ui/styles/floating-panel.css | 15 ++++++++++++--- 3 files changed, 42 insertions(+), 5 deletions(-) diff --git a/changes/fix-pinned-panel-locked.md b/changes/fix-pinned-panel-locked.md index 3c5daed8..da7e109a 100644 --- a/changes/fix-pinned-panel-locked.md +++ b/changes/fix-pinned-panel-locked.md @@ -5,3 +5,4 @@ Fixed - The docked panel drops its title and has an Undock button where the floating panel has its pin; the menu no longer offers Undock. - A byte fraction writes a unit both sides share once, as in 70/268 MB, so the docked memory meter, now labelled cgroup used, fits on one row. - A narrow collapsed panel shows both rates whole beside its buttons. +- The handle of a panel hidden at an edge keeps the header's spacing and the control's padding around its rates. diff --git a/e2e/widgets.spec.ts b/e2e/widgets.spec.ts index 7b0389f0..05d4a786 100644 --- a/e2e/widgets.spec.ts +++ b/e2e/widgets.spec.ts @@ -992,6 +992,31 @@ test.describe('header and edge at 1440', () => { }, edge); expect(Math.abs(tab.width - geometry.contentWidth)).toBeLessThanOrEqual(2); expect(tab.width).toBeLessThan(208 * 0.75); + // The light and the rates keep the control's padding from the handle's sides, the light the header's gap from the + // rates, and no rate is cut off. + const room = await handle(page).evaluate(el => { + const outer = el.getBoundingClientRect(); + const dot = el.querySelector('.rp-light')!.getBoundingClientRect(); + const icon = el.querySelector('.rp-widget-speed-icon')!.getBoundingClientRect(); + const values = [...el.querySelectorAll('.rp-widget-speed-value')]; + const end = Math.max(...values.map(value => value.getBoundingClientRect().right)); + const rates = el.querySelector('.rp-widget-speed')!.getBoundingClientRect(); + return { + start: dot.left - outer.left, + end: outer.right - end, + top: rates.top - outer.top, + bottom: outer.bottom - rates.bottom, + gap: icon.left - dot.right, + whole: values.every(value => value.scrollWidth <= value.clientWidth) + }; + }); + expect(room.start).toBeGreaterThanOrEqual(12); + expect(room.end).toBeGreaterThanOrEqual(12); + // The two rate lines keep the control's block padding above and below them. + expect(room.top).toBeGreaterThanOrEqual(6); + expect(room.bottom).toBeGreaterThanOrEqual(6); + expect(room.gap).toBeCloseTo(20, 0); + expect(room.whole).toBe(true); expect(geometry.corners).toEqual(['0px', '0px']); expect(geometry.border).toBe('0px'); }); @@ -1002,8 +1027,10 @@ test.describe('header and edge at 1440', () => { await page.locator('.rp-side-dock').getByRole('button', {name: 'Undock', exact: true}).click(); await expect(floating(page)).toBeHidden(); const summary = await box(handle(page)); - expect(summary.width).toBeLessThan(row.width * 0.75); - expect(Math.abs(summary.height - row.height)).toBeLessThanOrEqual(1); + // With the header's spacing and the control's padding, the summary still takes less than the row's width. + expect(summary.width).toBeLessThan(row.width * 0.8); + // Its two rate lines take their block padding, so it is never shorter than the row. + expect(summary.height).toBeGreaterThanOrEqual(row.height - 1); }); test('hover and keyboard focus show the hidden panel; leaving or Escape hides it again', async ({page}) => { await save(page, {...defaults(), pinned: false, edge: true}); diff --git a/src/ui/styles/floating-panel.css b/src/ui/styles/floating-panel.css index 4044eb81..b80c89b9 100644 --- a/src/ui/styles/floating-panel.css +++ b/src/ui/styles/floating-panel.css @@ -180,15 +180,19 @@ translate var(--rp-duration-panel) var(--rp-ease), visibility 0s linear var(--rp-duration-panel); } -/* The hidden panel's summary hugs its light and reserved rate width, flush with the screen edge. */ +/* The hidden panel's summary hugs its light and reserved rate width, flush with the screen edge. The light sits in a + control-wide square as in the panel's header, so it keeps the header's spacing and its outer side the control's + inline padding, which the handle adds after the rates. */ .rp-edge-handle { position: fixed; display: flex; align-items: center; box-sizing: border-box; inline-size: max-content; - block-size: var(--rp-control); - padding: 0 var(--rp-space-2); + /* The two-line summary sets the height, with the control's block padding around it; never below a control. */ + min-block-size: var(--rp-control); + padding: var(--rp-space-1h) 0; + padding-inline-end: var(--rp-space-3); border: 1px solid var(--rp-popover-border); font: inherit; color: var(--rp-text); @@ -197,6 +201,11 @@ box-shadow: var(--rp-elevated); pointer-events: auto; } +.rp-edge-handle .rp-widget-backend { + display: flex; + justify-content: center; + inline-size: var(--rp-control); +} /* The widest rate after its icon, so a summary with a reserved width keeps it as the rates change. */ .rp-widget-speed[data-reserve]::before { content: attr(data-reserve);