routing: with motion reduced, the magpie fades in and out at the dot instead of being gone (iryan_sun on X)

iryan_sun on X: the Routing page's magpie animation between agent and
provider is gone. The same report as vantiboolean's on 11-08 (50eec4994):
with prefers-reduced-motion (Windows' Animation effects off in WebView2,
macOS Reduce motion, or Settings' Reduce motion) bird() returned null, so
a request in flight had wires that faded and a dot, and no magpie. The
animation itself is intact on origin/main; with motion on the birds fly
(routing-sky-under, routing-held-dot).

Now bird() draws the magpie with motion reduced too, class "calm": no
flight (the flight is posed at its end, as before), wings still, and it
fades in by opacity alone (rtfade, 200ms, ease-out), stays 700ms and fades
out (250ms, opacity only; no translate or scale). With motion on nothing
changes.

Tests: routing-calm-in-flight.test.cjs now asserts that a bird appears
under reduced motion (system's and Settings'), its fade animation is
rtfade, rtfade's keyframes hold opacity and no transform, its wings have
no animation, it fades away and is removed.

Run (WSL magpie-desktop, Playwright 1.62.0; mote and mica both had other
sessions' full GUI suites and load over their cores):
- routing-calm-in-flight, both engines, system and Settings reduce, 1100
  and 420px: 8 of 8. Red on origin/main's client.js and routing.css with
  this test: all 8 (chromium timeout waiting for .rt-flier.calm).
- routing-sky-under alone, both engines x 5 langs x 4 widths: 40 of 40 (and
  40 of 40 on origin/main). routing-held-dot, routing-answered-still: ok.
  In a run of four files at once two routing-sky-under webkit cases were
  red (zh-TW and ja, 560px); alone they pass; filed on #6513.
- Rebased on f7173c79a: routing-calm-in-flight and i18n-keys, 12 of 12.
- The whole GUI suite (--test-concurrency=3, WSL) was started at the
  pre-rebase head; its result comes after this push, reds filed.
Not run: go suite (no Go changed); the real app with Reduce motion on.
This commit is contained in:
yetone
2026-11-20 00:24:54 +08:00
parent f7173c79a3
commit b17d9e3fca
3 changed files with 31 additions and 7 deletions
@@ -5614,9 +5614,11 @@ function routingPage(part) {
+ "</g></g>";
function bird(kind) {
if (still() || !shown()) return null;
if (!shown()) return null;
const g = document.createElementNS(NS, "g");
g.setAttribute("class", "rt-flier " + kind);
// with motion reduced the magpie doesn't fly or beat its wings: it fades
// in where the dot is put and fades out (routing.css .calm)
g.setAttribute("class", "rt-flier " + kind + (still() ? " calm" : ""));
g.innerHTML = FLIER;
sky.appendChild(g);
return g;
@@ -5624,8 +5626,10 @@ function routingPage(part) {
// off it goes, up and away, once it has let go of the dot
function away(b) {
if (!b) return;
b.classList.add("away");
setTimeout(() => b.remove(), 450);
// a calm one has been put down, not flown: it stays a while to be seen
const wait = b.classList.contains("calm") ? 700 : 0;
setTimeout(() => b.classList.add("away"), wait);
setTimeout(() => b.remove(), wait + 450);
}
function packet() {
const dot = document.createElementNS(NS, "circle");
@@ -55,6 +55,11 @@
.rt-flier .wing.far { animation-delay: -.03s; }
@keyframes rtflap { 0%, 100% { transform: scaleY(1); } 55% { transform: scaleY(-.62) skewX(-8deg); } }
.rt-flier .rt-lift { animation: rtcome .3s ease-out; transition: transform .45s cubic-bezier(.3, 0, .2, 1), opacity .45s; }
/* motion reduced: the magpie only fades in and out, wings still (opacity alone) */
.rt-flier.calm .wing { animation: none; }
.rt-flier.calm .rt-lift { animation: rtfade .2s cubic-bezier(.23, 1, .32, 1); transition: opacity .25s cubic-bezier(.23, 1, .32, 1); }
.rt-flier.calm.away .rt-lift { transform: none; opacity: 0; }
@keyframes rtfade { from { opacity: 0; } }
.rt-flier.away .rt-lift { transform: translate(14px, -16px) scale(.8); opacity: 0; }
@keyframes rtcome { from { transform: translate(-6px, -10px) scale(.85); opacity: 0; } }
.rt-srcs { position: relative; z-index: 1; min-width: 0; display: grid; gap: 10px; }
@@ -4,7 +4,7 @@
// animation", every wire dotted and still while two accounts answered).
// Reduced motion is the system's (Windows' "Animation effects" off, which
// WebView2 reports as prefers-reduced-motion) or Settings' Reduce motion.
// Nothing moves along a wire then, but the flowing wires fade and come
// Nothing moves along a wire then (the magpie fades in and out, wings still), but the flowing wires fade and come
// back, and so does the dot held at the account answering. Once the
// request is over nothing fades. No backend, the API is faked here.
const assert = require("node:assert/strict");
@@ -73,6 +73,21 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// two requests at once, one at each account: the reporter's two
// rows "answering another request…"
send(route(2, [at(1, false)]), route(3, [at(2, false)]));
// the magpie that brings each request is there, still: it fades in
// by opacity alone, its wings don't beat, and it fades away again
await page.waitForFunction(() => document.querySelector(".rt-sky .rt-flier.calm"));
const bird = await page.evaluate(() => {
const b = document.querySelector(".rt-sky .rt-flier.calm");
const css = (e) => getComputedStyle(e);
const rule = [...document.styleSheets].flatMap((sh) => { try { return [...sh.cssRules]; } catch { return []; } }).find((r) => r.name === "rtfade");
return { lift: css(b.querySelector(".rt-lift")).animationName, wings: [...b.querySelectorAll(".wing")].map((w) => css(w).animationName),
keys: rule ? [...rule.cssRules].map((k) => k.style.cssText) : null };
});
assert.equal(bird.lift, "rtfade", "the bird fades in");
assert.deepEqual(bird.wings, ["none", "none"], "its wings are still");
assert(bird.keys && bird.keys.every((k) => /opacity/.test(k) && !/transform/.test(k)), `fade by opacity alone: ${bird.keys}`);
await page.waitForFunction(() => document.querySelector(".rt-sky .rt-flier.calm.away"), null, { timeout: 5000 });
await page.waitForFunction(() => !document.querySelector(".rt-sky .rt-flier"), null, { timeout: 5000 });
await page.waitForFunction(() => document.querySelectorAll(".rt-accts li.now").length === 2);
await page.waitForFunction(() => document.querySelectorAll(".rt-flows path[d]").length >= 2);
// the wires' dashes stand still: no animation and no offset
@@ -91,8 +106,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const held = () => page.evaluate(() => getComputedStyle(document.querySelector(".rt-sky .pkt.held")).opacity);
const heldWas = await held();
await page.waitForFunction((was) => getComputedStyle(document.querySelector(".rt-sky .pkt.held")).opacity !== was, heldWas);
// no bird flies with motion reduced
assert.equal(await page.locator(".rt-flier").count(), 0);
// no bird is left on the stage once it has faded
assert.equal(await page.locator(".rt-flier:not(.calm)").count(), 0);
// both are answered: nothing fades any more, the layer is whole
send(route(2, [at(1, true)]), route(3, [at(2, true)]));