From 0b4cda048c098f135181357ed35fd762f2467805 Mon Sep 17 00:00:00 2001 From: yetone Date: Sun, 8 Nov 2026 03:08:53 +0800 Subject: [PATCH] gui: the tray panel shrinks back to a short tab, gliding there The tray panel was held at its tallest tab's height (#124): fit() measured every tab and asked for the largest. Once Routing or Usage had been opened, Agents sat over empty room under its rows until the panel was let go (refeccd on Discord, macOS). fit() now lays every tab out the same way and asks for the height of the tab showing (Agents when none is set), so the panel shrinks as well as grows. #124's complaint was the panel jumping bigger on a tab switch, so a tab picked glides the edge there instead (TAB_GLIDE: 240ms on app.css's --ease-out, as .nav-hl; a jump under reduced motion). Content fits inside a tab (rows unrolling, Allowances landing) are unchanged. Siblings: the Go side already shrinks on every OS. FitPanel takes the height asked, panelFrame clamps it to panelMin/panelMax/the screen, and glidePanel animates the Mac's frame with its top under the menu bar and steps Windows/Linux by the tray icon. All three take their height from this one fit(), so nothing there changed. The web host has no panel. panel-fit-tabs.test.cjs gets "the tray panel shrinks back to a short tab": two agents and Routing's eight requests, Agents -> Routing -> Agents, with reduced motion and without. Agents' height is asked again, and the tab's fit carries ms=240 and the ease (none under reduced motion). Its Routing-skeleton check now picks the Routing tab first, as that is the tab whose height it is about. panel-usage's assertion is now the showing tab's height, not the tallest. Run on mote (mote-run). At this commit, rebased on d32a7a70c: gofmt -l internal/gui nothing; go test -tags nogui ./internal/gui ok (sandbox HOME); panel-fit-tabs, panel-usage, panel-fit-order, panel-fold 40/40. Earlier, at the same change on c7c05dcf2: - new test on origin/main's app.js: 10 of 10 red, Chromium and WebKit x en/zh/zh-TW/ja/de: "reduce: Routing asked no taller a panel than two agents: 163 629" (the short tab asked the tallest's 629) - with the change: panel-fit-tabs + panel-usage 24/24 ok (both engines, five languages); again at the rebased head with i18n-keys: 27/28, the one red is i18n-keys' "a plugin's words are its own", filed as #5332, #5426, #5482 - the 46 GUI files that read /api/window/fit (at d32a7a70c, before the rebase; the change is the same): 1182/1186. Reds, none in the panel: images-codex-one (Settings window; red alone on origin/main d32a7a70c too, #4618, commented) and view-open-wheel's "wheels unheard, usage, en, 1000px" in WebKit (window only, no panel page, where fit() returns at once; #4132) - gofmt -l internal/gui: nothing; go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet ./internal/gui: ok - go test -tags nogui ./internal/gui (sandbox HOME, pinned caches): ok (before trimming, TestCoreScriptBudget was 346 bytes over; the comments were cut, the budget not raised) Not tried: the real app's panel on the Mac, Windows or Linux (no desktop session driven); the whole GUI suite (mote's suite.lock queue was full); go test ./... . Reported-by: refeccd (Discord) --- docs/subsystems/gui-shell.md | 1 + internal/gui/assets/app.js | 11 ++--- internal/gui/tests/panel-fit-tabs.test.cjs | 47 ++++++++++++++++++++-- internal/gui/tests/panel-usage.test.cjs | 11 +++-- 4 files changed, 55 insertions(+), 15 deletions(-) diff --git a/docs/subsystems/gui-shell.md b/docs/subsystems/gui-shell.md index 6d72317c9..e5697dfb9 100644 --- a/docs/subsystems/gui-shell.md +++ b/docs/subsystems/gui-shell.md @@ -623,6 +623,7 @@ covers it in both engines, every language and a narrow window. - A box that scrolls inside a page keeps the wheel at its ends: wheeled past its top or foot, the page stays where it was (碳碳双键 on Discord, Requests' list on Usage). `holds` in app.js marks every box between the pointer and its `.view` that scrolls vertically and overflows (`.holds`), on `pointerover` and on each wheel, and app.css gives `.holds` `overscroll-behavior-y: contain` (the Mac's bounce stays, on the box). It is not one CSS rule for every box because Chromium (WebView2, magpie web) holds the wheel in a box told to contain even when it doesn't overflow, and in one that scrolls only sideways, so a short list or a wide table would stop the page. `.holds` is under `:where()`, so a rule that passes the wheel on still does (`.mchips` in a short window, #833). The page itself (`.view`) and the document chain as before. An engine with no `overscroll-behavior` (Safari 15, macOS 12's WebKit until Safari is updated; Safari 16+, WebKitGTK and Chromium have it) gets the same from `compat.js`: a wheel over a `.holds` box at its end in the wheel's direction is cancelled, so there the Mac's bounce at the box's end is lost. A guard in `inner-scroll-contain.test.cjs` builds every rule in every stylesheet under assets that scrolls a box vertically from its own selector, fills it and points at it, and fails naming the file and selector of one that doesn't hold the wheel (a rule that sets `overscroll-behavior` back to auto, or a box `holds` doesn't reach). See `inner-scroll-contain.test.cjs`. - There are no native `