diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css index 26bbc8b3d..4041628b9 100644 --- a/internal/gui/assets/app.css +++ b/internal/gui/assets/app.css @@ -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; } diff --git a/internal/gui/tests/plugin-github-filter.test.cjs b/internal/gui/tests/plugin-github-filter.test.cjs index b2a75b812..b7f381e04 100644 --- a/internal/gui/tests/plugin-github-filter.test.cjs +++ b/internal/gui/tests/plugin-github-filter.test.cjs @@ -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 {