From 7c23ecea9d3783e5f7906b734ea4e94225ecc0fd Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 11 Oct 2026 23:57:14 +0800 Subject: [PATCH] gui: the tray's quota spark no longer has a dotted now line, and clicking into the panel's list no longer rings the whole list (#1601, MizuIro-H) The reporter uses the Linux GTK/WebKit tray panel. Two of their points reproduce in both engines: - The 16px spark under a card drew the large curve's dotted upright now line. In that size it reads as a stray mark under the curve. The spark's solid line already ends at now. drawQuotaPlot now leaves the now line out when it draws thin; the large curves keep theirs. - A view takes focus (tabIndex -1) so the arrow keys scroll it after a click. A click and then a key made it :focus-visible, and the browser drew its own ring round the whole list: 3px in WebKit, 1px in Chromium. `.view:focus { outline: none }`. The view can't be reached by Tab, and every control inside it keeps its own ring. The content cut off at the bottom in their screenshot is the list before it is scrolled. Scrolled to its end at 440x560, the last card ends 44px above the footer at both 1x and 1.75x, in both engines. What was run: - quota-curve.test.cjs now checks that there is no now line in the spark, and that a click and then a key leave the view with no outline. - Breaking each fix by hand turns the test red in chromium and webkit, en and zh. - quota-curve, balance-curve, readable-focus, click-scroll and panel-balance-order pass in both engines, twice in a row after the rebase. In one earlier run of this set, click-scroll's late-wheel subtest went red once in Chromium under load. It is filed as #1660; this change touches no scrolling. - The new focus check runs after the spark is measured. A click focuses the window, the window's focus reloads the cards, and a card measured during that redraw had no box. - A probe of the reporter's cards (Codex with credits, Command Code, and SudoCode and DeepSeek balances) at 440x560, 1x and 1.75x, light and dark. Not tried: real Linux, WebKitGTK or Wayland. The lightweight panel that never maps (Gdk-CRITICAL) is not looked at here. --- internal/gui/assets/app.css | 3 +++ internal/gui/assets/app.js | 4 +++- internal/gui/tests/quota-curve.test.cjs | 15 ++++++++++++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 71142bf3b..c2a950308 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -441,6 +441,9 @@ body.window .view { padding: 2px 16px 8px; } switch at the other (#860); the tables and charts of Routing, Usage and Sessions take the whole width */ body.window :is(#view-agents, #view-providers, #view-gateway, #view-library, #view-plugins, #view-settings) { padding-left: max(16px, calc(50% - 600px)); padding-right: max(16px, calc(50% - 600px)); } +/* a view takes focus (tabIndex -1) only so the keys scroll it after a click; + a ring round the whole list there marks nothing a reader can act on (#1601) */ +.view:focus { outline: none; } .view > .view-room { flex: none; pointer-events: none; } /* see "where the reader is" */ /* Windows and Linux draw a classic scrollbar, arrows and all; a thin rounded thumb instead, like the overlay one macOS shows (left as it is there) */ diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index dd8b6aecc..0bbf1e0f5 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -14684,7 +14684,9 @@ function drawQuotaPlot(g, lines, x0, x1, w, h, now, thin) { const d = quotaPaths(l.points, x0, x1, w, h); if (d) g.append(sv("path", { d, class: "qc-line" + (short ? " qc-short" : ""), "data-name": l.name }, { stroke: color })); }); - if (now >= x0 && now <= x1) g.append(sv("line", { x1: X(now), x2: X(now), y1: 0, y2: h, class: "qc-now" })); + // a spark ends at now already, and in 16px the dotted now line read as a + // stray mark under the curve (#1601); the large curve keeps it + if (!thin && now >= x0 && now <= x1) g.append(sv("line", { x1: X(now), x2: X(now), y1: 0, y2: h, class: "qc-now" })); } // quotaCurve: an account's windows over time, under its meters, with the // range turned for every card at once diff --git a/internal/gui/tests/quota-curve.test.cjs b/internal/gui/tests/quota-curve.test.cjs index c04f801ac..4078ac69b 100644 --- a/internal/gui/tests/quota-curve.test.cjs +++ b/internal/gui/tests/quota-curve.test.cjs @@ -9,7 +9,8 @@ // across a reload, and no click moves the page. Several accounts on a card // are set apart by a rule, a curve's legend before the next one too. An // account with no readings has no curve. The tray's card has a thin line of -// its first window's cycle. +// its first window's cycle, with no now line (#1601), and a click into the +// tray's list rings nothing. // English and Chinese, light and dark; no backend, the API is faked here. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); @@ -183,9 +184,21 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", assert.equal(await spark.locator("path.qc-line").count(), 1); assert.equal((((await spark.locator("path.qc-line").getAttribute("d")).match(/M/g)) || []).length, 1, "the current cycle only"); assert.equal(await spark.locator("line.qc-even").count(), 1); + // the line ends at now already; in 16px a dotted now line read as a + // stray mark under the curve (#1601) + assert.equal(await spark.locator("line.qc-now").count(), 0, "no now line in the thin spark"); const sb = await spark.boundingBox(), cb = await pcard.boundingBox(); assert.ok(sb.height <= 17 && sb.width > cb.width * 0.7, `thin and across the card: ${JSON.stringify(sb)}`); assert.equal(await panel.locator(".pq-card", { hasText: "Kimi" }).locator(".pq-spark").count(), 0); + // a click into the list, then a key to scroll it, rings nothing: the + // view takes focus only so the keys scroll it (#1601, WebKitGTK) + // (after the spark is measured: the click focuses the window, whose + // focus reloads and redraws the cards, so a card measured then can be + // between two draws) + await panel.mouse.click(220, 300); + await panel.keyboard.press("ArrowDown"); + const ring = await panel.evaluate(() => { const a = document.activeElement, cs = getComputedStyle(a); return { view: a.classList.contains("view"), outline: cs.outlineStyle === "none" ? "none" : cs.outlineStyle + " " + cs.outlineWidth }; }); + assert.deepEqual(ring, { view: true, outline: "none" }, "the scrolled view shows no focus ring"); // turned off in the window, the tray's line goes too, and stays gone const win = await panel.context().newPage(); await win.route("**/*", serve(lang, "dark", false, data));