gui: Plugins' kinds on GitHub scroll in themselves where a 420px window is too narrow for them, as Japanese's are

Found while reviewing #2381 at 420px: the "Unofficial, on GitHub"
section's kinds in Japanese (すべて · 31 … エージェント · 1) are 400px
in a 388px bar in Chromium (385 in 380 in WebKit), so the bar ran 12px
past its edge. plugin-github-filter.test.cjs ran only at 980 and 440, and
checked for overflow only after the page's search had taken the kinds
away, so it never saw it.

Fix: .pm-ghbar .segs joins the strips that scroll in themselves (the
regions, Connect's APIs, Usage's agents): overflow-x auto, no bar on a
Mac, the app's thin one elsewhere, options flex: none.

Test: plugin-github-filter.test.cjs runs at 1100, 980 and 420, and checks
for overflow with the kinds drawn as well as at its end. At 420 WebKit
put Show all under the footer, and a scroll by code (the click's own
scrolling into view) is put back by the app's no-unasked-scroll hold, so
the footer took the click (de 420, red on dd25997a4 too); the test now
scrolls with the wheel to it, as a reader does.

Run:
- plugin-github-filter.test.cjs, en/zh/zh-TW/ja/de at 1100/980/420:
  chromium 16/16, webkit 16/16. Without the CSS: ja 420 red in both
  engines ([12,0,0] chromium, [5,0,0] webkit), the rest green.
- strip-scrollbar, sess-agent-strip (the strips this rule shares):
  2/2 each in chromium and webkit. plugin-github.test.cjs 25/25 each.
- No Go file changed.

Full suite: SUITE_LINE
This commit is contained in:
yetone
2026-10-15 23:08:04 +08:00
parent dbf331211f
commit 98d99cd70e
2 changed files with 34 additions and 16 deletions
+8 -7
View File
@@ -2869,20 +2869,21 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
/* a strip too wide for the window scrolls in itself: the regions,
Connect's five APIs on a narrow one, and Usage → Sessions' agents,
which #929 left widening the whole page until its last agent's
filter was only reachable by dragging the page sideways */
.segs.regions, .connect .segs, #sessAgent { max-width: 100%; overflow-x: auto; }
filter was only reachable by dragging the page sideways, and Plugins'
kinds on GitHub, wider than a 420px window in Japanese */
.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs { max-width: 100%; overflow-x: auto; }
/* no scrollbar-width here: Chromium (WebView2) then drops every
::-webkit-scrollbar rule and draws Windows' classic bar, arrows and all,
under the strip; the app's thin thumb instead, slimmer still */
:where(body:not(.mac)) :is(.segs.regions, .connect .segs, #sessAgent)::-webkit-scrollbar { height: 6px; }
:where(body:not(.mac)) :is(.segs.regions, .connect .segs, #sessAgent)::-webkit-scrollbar-thumb { border-width: 1px; }
:where(body:not(.mac)) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs)::-webkit-scrollbar { height: 6px; }
:where(body:not(.mac)) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs)::-webkit-scrollbar-thumb { border-width: 1px; }
/* on a Mac they scroll with no bar, as a Mac's own tab strips do: the
system's overlay bar showed over the options' lower half for a moment
after each scroll, and a click there went to the bar, which paged the
strip sideways and picked nothing (#1620) */
:where(body.mac) :is(.segs.regions, .connect .segs, #sessAgent) { scrollbar-width: none; }
:where(body.mac) :is(.segs.regions, .connect .segs, #sessAgent)::-webkit-scrollbar { display: none; }
.segs.regions .opt, .connect .segs .opt, #sessAgent .opt { flex: none; }
:where(body.mac) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs) { scrollbar-width: none; }
:where(body.mac) :is(.segs.regions, .connect .segs, #sessAgent, .pm-ghbar .segs)::-webkit-scrollbar { display: none; }
.segs.regions .opt, .connect .segs .opt, #sessAgent .opt, .pm-ghbar .segs .opt { flex: none; }
/* a custom provider's five Base URL APIs wrap to a second row where the
editor is too narrow for them (#1346); the thumb follows the row */
.segs.base-apis { max-width: 100%; flex-wrap: wrap; }
@@ -5,12 +5,12 @@
// its own that narrows them by name, author or description as it is typed.
// Both narrow what the page's search already found, the field keeps its
// focus and its node while the page is drawn again under it (npm's answer
// comes while typing), nothing is left over at 440px, and a filter that
// comes while typing), nothing is left over at 420px, and a filter that
// leaves nothing says so with a Show all. The repositories are the dev
// instance's real /api/plugins/github answer of 2026-10-13 (31: 27
// providers, 3 middleware, an agent); the API is faked and no request
// leaves the page. English, Chinese, Traditional Chinese, Japanese and
// German, 980px and 440px.
// German, 1100px, 980px and 420px.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
const path = require("node:path");
@@ -53,7 +53,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert(["chromium", "webkit"].includes(engine), "BROWSER must be chromium or webkit");
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: process.env.PLAYWRIGHT_CHANNEL || "chromium" }));
t.after(() => browser.close());
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) for (const width of [980, 440]) {
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) for (const width of [1100, 980, 420]) {
await t.test(`${lang} ${width}px`, async () => {
const ctx = await browser.newContext({ viewport: { width, height: 860 } });
const page = await ctx.newPage();
@@ -72,6 +72,27 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const want = async (rs) => [await tr("All") + " · " + rs.length, ...(await Promise.all(["Provider", "Middleware", "Agent"].map(async (k) => (await tr(k)) + " · " + rs.filter((r) => kindOf(r) === k).length)))];
const kinds = sec.locator(".pm-ghkinds .opt");
assert.deepEqual(await kinds.allTextContents(), await want(GH.repos));
// the kinds and the field, nothing left over at this width: the
// kinds in Japanese are wider than the bar at 420px
const overflow = () => page.evaluate(() => {
const bar = document.querySelector("#view-plugins .pm-ghbar");
const v = document.querySelector("#view-plugins");
return [bar.scrollWidth - bar.clientWidth, v.scrollWidth - v.clientWidth, document.documentElement.scrollWidth - innerWidth];
});
assert.deepEqual((await overflow()).map((x) => Math.max(0, x)), [0, 0, 0], JSON.stringify(await overflow()));
// a reader scrolls to what's under the footer with the wheel; a
// scroll by code, as a click's own scrolling into view, is put
// back (no unasked scroll), and the footer took WebKit's click
const press = async (b) => {
await page.mouse.move(width / 2, 400);
for (let i = 0; i < 12; i++) {
const [at, foot] = [await b.boundingBox(), await page.locator(".foot").boundingBox()];
if (at && (!foot || at.y + at.height <= foot.y)) break;
await page.mouse.wheel(0, 200);
await page.waitForTimeout(80);
}
await b.click();
};
const field = sec.locator(".pm-ghfind input");
assert.equal(await field.getAttribute("placeholder"), await tr("Filter by name, author or description"));
@@ -107,7 +128,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// Show all puts back every kind and every card
await kinds.nth(3).click();
await field.fill("zzz-nothing");
await none.locator("button").click();
await press(none.locator("button"));
assert.equal(await field.inputValue(), "");
assert.equal(await cards.count(), 31);
assert.equal(await sec.locator(".pm-ghkinds .opt.on").textContent(), (await want(GH.repos))[0]);
@@ -122,11 +143,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await cards.count(), tl.filter((r) => has(r, "seed")).length);
// nothing left over at any width
const over = await page.evaluate(() => {
const bar = document.querySelector("#view-plugins .pm-ghbar");
const v = document.querySelector("#view-plugins");
return [bar.scrollWidth - bar.clientWidth, v.scrollWidth - v.clientWidth, document.documentElement.scrollWidth - innerWidth];
});
const over = await overflow();
assert.deepEqual(over.map((x) => Math.max(0, x)), [0, 0, 0], JSON.stringify(over));
assert.deepEqual(errors, []);
} finally {