From b3f59534956d9d9a6b8b68e57e03d8e50ca42131 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 21 Oct 2026 23:31:34 +0800 Subject: [PATCH] routing: an open group's heading looks as every editor's does, not as the Models fold chip The owner, 10-21: on an opened routing group the heading's space above differed from below, and its line curved at the ends. The heading had the class .fold to fold back into its row, and .fold is the Models head's chip: padding 3px 6px 3px 4px, a 6px radius, the faint colour and a pill background on hover. On the heading that gave 3px above against 8px below, rounded ends on its bottom line, a dimmed name and a box over it on hover. It now has its own class (folds), which keeps the pointer and adds a focus ring; the layout is .editor .ehead's, as on every other editor. Run on origin/main 4042aa4d1 + this commit, macOS, playwright 1.62.0: - group-fold.test.cjs: 4/4, chromium and webkit, en and zh. Its new check (no padding above, square corners on the line, the name in the page's colour, no box on hover) is red with the old class (top 3px). - Looked at in dark theme (chromium zh): the heading and the editor. - Every routing-*, group-*, gateway-key-groups, names-fold and models-fold file (124): 1422 pass, 2 red under the run's load, both 14/14 alone in webkit and both filed on main already: group-member-weight webkit de 420 (#2387), routing-rule-remove webkit en 390 (#3094, #3096). - go test ./internal/gui/ -run Budget ok. Not run: the rest of the GUI suite (the change is the routing plugin's heading only). --- internal/gui/assets/plugins/routing/client.js | 7 +++++-- internal/gui/assets/plugins/routing/routing.css | 3 ++- internal/gui/tests/group-fold.test.cjs | 17 ++++++++++++++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/internal/gui/assets/plugins/routing/client.js b/internal/gui/assets/plugins/routing/client.js index 298149dee..9b3c02a08 100644 --- a/internal/gui/assets/plugins/routing/client.js +++ b/internal/gui/assets/plugins/routing/client.js @@ -4685,9 +4685,12 @@ function routingPage(part) { if (g && d.id === undefined) d.id = g.id; // an open group folds back into its row from its heading, as it opened // from the row (ARNO on Discord) — only while nothing in it has - // changed, so a stray click never throws an edit away; Cancel does that + // changed, so a stray click never throws an edit away; Cancel does that. + // Its own class, not .fold: that is the Models head's chip, whose + // padding and corners made the heading's line curve at its ends and + // its space above differ from below (the owner, 10-21) if (g) { - h.classList.add("fold"); + h.classList.add("folds"); h.setAttribute("role", "button"); h.tabIndex = 0; h.setAttribute("aria-expanded", "true"); diff --git a/internal/gui/assets/plugins/routing/routing.css b/internal/gui/assets/plugins/routing/routing.css index c234d4aae..896202535 100644 --- a/internal/gui/assets/plugins/routing/routing.css +++ b/internal/gui/assets/plugins/routing/routing.css @@ -484,7 +484,8 @@ button.rt-session { cursor: pointer; } .rt-group.rt-gpick { cursor: default; } .rt-group.rt-gpick.on { background: var(--card-2); } .rt-gedit { cursor: default; scroll-margin-top: 12px; } -.rt-gedit .ehead.fold { cursor: pointer; } +.rt-gedit .ehead.folds { cursor: pointer; } +.rt-gedit .ehead.folds:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .rt-gedit .segs { max-width: 100%; } /* its hint as close under the choices as every other row's: 4px */ .rt-gedit .ctx-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; } diff --git a/internal/gui/tests/group-fold.test.cjs b/internal/gui/tests/group-fold.test.cjs index 608936d93..be9c6b45c 100644 --- a/internal/gui/tests/group-fold.test.cjs +++ b/internal/gui/tests/group-fold.test.cjs @@ -3,7 +3,8 @@ // (ARNO on Discord: 路由组详情现在可以单击展开,是否可以再加上单击收起): // a click, or Enter on it, closes the editor while nothing was changed; // with a change it stays open and says to Save or Cancel, so no edit is -// lost. Nothing is saved by folding. English and Chinese. +// lost. Nothing is saved by folding. The heading looks as every editor's +// does: not the Models head's fold chip. English and Chinese. const assert = require("node:assert/strict"); const fs = require("node:fs/promises"); const path = require("node:path"); @@ -82,6 +83,20 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await head.waitFor(); assert.equal(await head.getAttribute("title"), w.fold); assert.equal(await head.getAttribute("aria-expanded"), "true"); + // laid out as every editor's heading (the owner, 10-21: the space + // above it differed from below, and its line curved at the ends): + // no padding above, square corners on its line, its name in the + // page's colour, and no box drawn over it on hover + await head.hover(); + const look = await head.evaluate((h) => { + const s = getComputedStyle(h), b = getComputedStyle(h.querySelector("b")); + return { top: s.paddingTop, left: s.paddingLeft, radius: s.borderBottomLeftRadius, bg: s.backgroundColor, + name: b.color, fg: getComputedStyle(document.body).color, display: s.display }; + }); + assert.deepEqual({ top: look.top, left: look.left, radius: look.radius, display: look.display }, + { top: "0px", left: "0px", radius: "0px", display: "flex" }, JSON.stringify(look)); + assert.match(look.bg, /^(transparent|rgba\(0, 0, 0, 0\))$/, "no box on hover"); + assert.equal(look.name, look.fg, "the name is in the page's colour"); await head.click(); await closed();