Settings' Off/On (Lightweight mode in the report) shook back and forth when
clicked, and the first click on the page replayed every thumb's animation.
Why, in the old slide():
- Every save's answer runs renderSettings(), which draws a new control and
a new thumb for each one. The new thumb took its place from what was
remembered: within 300ms of the click it started from the position
before the click, so a redraw mid-glide sent the thumb back to Off and
slid it again.
- Settings is drawn while hidden (at start, or from another tab), so every
control was remembered 0 wide. thumbsUnderPicks put the DOM right when
the tab was shown but never the memory, so the first save's redraw grew
every thumb on the page in from the left.
#1211 (700315dff) only kept a press made across a redraw (pointerdown on
one button, pointerup on its replacement); it never touched how the thumb
moves across a redraw, which is why the shake stayed.
Now:
- A redrawn control takes over the old thumb element itself, with its
running animation, so a glide in flight just goes on. No clock math.
- slide() glides only when the target changes, from where the thumb is
drawn now (computed transform), with a WAAPI animation; the CSS
transform/width transition is gone so nothing else starts one.
- One shared ResizeObserver puts a thumb under its option, without motion,
when its control is shown or resized. A control drawn hidden is never
measured. thumbsUnderPicks and the two per-bar ResizeObservers go.
Run:
- segs-glide.test.cjs (new): records every thumb on General per frame and
between frames, for an answer mid-glide, an answer at once with two more
redraws on the way, and a refused save; Chromium and WebKit, en zh zh-TW
ja de, 900 and 440px. 80/80 over two runs; on the old code 20/20 fail
(thumb jumps back to 0).
- Full GUI suite, concurrency 6: 6157 tests, 10 fail. Each fails the same
alone on origin/main 96de5cac2 (library-mcp-tool-switch #1609,
privacy-hides-accounts and usage-stale-answer #1632) or passes alone on
both (purpose-filter, routing-signin, filed in #1632). tencent-cloud's
WebKit flake also happens on the old code (#1620).
- Checked by hand against a sandbox magpie web (real server, sandbox
HOME): the clicked thumb moves one way, no other thumb moves, including
Settings opened from Usage first.
- gofmt, go vet (darwin, linux nogui, windows), go test ./internal/gui.
Not tried: the Wails app itself, Windows and Linux webviews.