Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: stop Reduce motion turning on a transition for every element (#17466)

Daniel Hane4ef63188151
diff --git a/studio/frontend/src/features/browser/annotate-layer.tsx b/studio/frontend/src/features/browser/annotate-layer.tsx
index 68e2a2031cf..a4cee763ac3 100644
--- a/studio/frontend/src/features/browser/annotate-layer.tsx
+++ b/studio/frontend/src/features/browser/annotate-layer.tsx
@@ -484,7 +484,7 @@ export function AnnotateLayer({
cancelAnimationFrame(frame);
frame = requestAnimationFrame(() => setFrame((value) => value + 1));
};
- // Reduced motion gives zoom a 0.01ms transition, so content settles when it ends.
+ // A zoom that transitions settles when it ends; an instant one is redrawn by the [zoom] effect below.
const zoomed = (event: TransitionEvent) => event.propertyName === "zoom" && redraw();
page.addEventListener("scroll", redraw, { capture: true, passive: true });
page.addEventListener("transitionend", zoomed, true);
diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.css
index f7dbc0b9b8d..c8c1906d9c4 100644
--- a/studio/frontend/src/index.css
+++ b/studio/frontend/src/index.css
@@ -1808,15 +1808,22 @@ html.pointer-cursors
cursor: pointer;
}
-/* JS-driven springs are handled via MotionConfig in the provider. */
+/* JS-driven springs are handled via MotionConfig in the provider.
+ 0s, not 0.01ms, on `*`: transition-property defaults to all, so a nonzero duration transitions
+ every property of every element (Chromium: thousands of no-op scrollbar-color transitions per
+ restyle in a long chat). Class-declared transitions and the overlays native-view.ts follows
+ keep 0.01ms so transitionend still fires. */
html.force-reduced-motion *,
html.force-reduced-motion *::before,
html.force-reduced-motion *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
- transition-duration: 0.01ms !important;
+ transition-duration: 0s !important;
scroll-behavior: auto !important;
}
+html.force-reduced-motion :is([class*="transition"], [data-sonner-toast], .find-bar-surface, [data-native-clickable], [data-native-rail] > *) {
+ transition-duration: 0.01ms !important;
+}
/* Same popup exemption as the OS-level media block below. */
html.force-reduced-motion [data-radix-popper-content-wrapper] {
@@ -5650,9 +5657,13 @@ html.force-reduced-motion .sidebar-section-drop-line {
html:not(.force-motion) *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
- transition-duration: 0.01ms !important;
+ transition-duration: 0s !important;
scroll-behavior: auto !important;
}
+ /* Same split as the html.force-reduced-motion block above. */
+ html:not(.force-motion) :is([class*="transition"], [data-sonner-toast], .find-bar-surface, [data-native-clickable], [data-native-rail] > *) {
+ transition-duration: 0.01ms !important;
+ }
/* The duration above turns on transitions everywhere (transition-property defaults to all), so
Radix moving a popup from its parking spot to its anchor became a one-frame slide in WebKit. */
diff --git a/studio/frontend/tests/reasoning-grid-collapse.test.ts b/studio/frontend/tests/reasoning-grid-collapse.test.ts
index f787b10b0a9..67eaa8e483c 100644
--- a/studio/frontend/tests/reasoning-grid-collapse.test.ts
+++ b/studio/frontend/tests/reasoning-grid-collapse.test.ts
@@ -168,12 +168,13 @@ test("tool panes avoid measurement and height keyframes; the sidebar keeps its a
test("reduced motion is reached by the transition, not bypassed by it", () => {
const indexCss = readText("../src/index.css");
- // Both reduced-motion blankets force transition-duration too, covering the grid collapse.
+ // Both reduced-motion blocks shorten an element's transition when a Tailwind class declares it,
+ // which covers the grid collapse (`transition-[grid-template-rows]`), so its transitionend fires.
assert.ok(indexCss.includes("html.force-reduced-motion *"));
assert.ok(indexCss.includes("@media (prefers-reduced-motion: reduce)"));
assert.equal(
- indexCss.match(/transition-duration: 0\.01ms !important;/g)?.length,
+ indexCss.match(/:is\(\[class\*="transition"\][^{]*\{\s*transition-duration: 0\.01ms !important;/g)?.length,
2,
- "both reduced-motion blankets must force transition-duration, not only animation-duration",
+ "both reduced-motion blocks must shorten class-declared transitions, not only animation-duration",
);
});
diff --git a/studio/frontend/tests/reduced-motion-implicit-transitions.test.ts b/studio/frontend/tests/reduced-motion-implicit-transitions.test.ts
new file mode 100644
index 00000000000..ae78bbcfcfc
--- /dev/null
+++ b/studio/frontend/tests/reduced-motion-implicit-transitions.test.ts
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+// The Reduce motion `*` blankets in index.css must use transition-duration 0s: transition-property
+// defaults to all, so a nonzero duration transitions every property of every element, and Chromium
+// starts a no-op scrollbar-color transition on each `* { scrollbar-color }` element per restyle
+// (2,550 per body-level restyle at 40 turns in Liquid Glass; thread scroll at 200 turns 0.6-1.2 s
+// of main-thread CPU against 0.17-0.21 s). Only class-declared transitions and the overlays
+// native-view.ts follows keep the 0.01ms that still fires transitionend.
+
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import test from "node:test";
+import { fileURLToPath } from "node:url";
+
+const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
+const read = (rel: string) => readFileSync(path.join(ROOT, rel), "utf8");
+
+const BLANKETS = ["html.force-reduced-motion *", "html:not(.force-motion) *"];
+
+type Rule = { selectors: string[]; body: string };
+
+function rules(css: string): Rule[] {
+ const out: Rule[] = [];
+ const flat = css.replace(/\/\*[\s\S]*?\*\//g, "");
+ for (const m of flat.matchAll(/([^{}@;]+)\{([^{}]*)\}/g)) {
+ const selectors = m[1].split(",").map((s) => s.trim().replace(/\s+/g, " ")).filter(Boolean);
+ out.push({ selectors, body: m[2] });
+ }
+ return out;
+}
+
+function duration(body: string): string | null {
+ const m = body.match(/transition-duration\s*:\s*([^;!]+)/);
+ return m ? m[1].trim() : null;
+}
+
+/** Reduce motion `*` blankets that give every element a nonzero transition-duration. */
+export function implicitTransitionBlankets(css: string): string[] {
+ const bad: string[] = [];
+ for (const rule of rules(css)) {
+ const blanket = rule.selectors.find((s) => BLANKETS.includes(s));
+ if (!blanket) continue;
+ const value = duration(rule.body);
+ if (value !== null && !/^0m?s$/.test(value)) bad.push(`${blanket} { transition-duration: ${value} }`);
+ }
+ return bad;
+}
+
+/** The selector lists of the rules that hand class-declared transitions back their 0.01ms. */
+function exemptions(css: string): string[] {
+ return rules(css)
+ .filter((r) => duration(r.body) === "0.01ms" && r.selectors.join(",").includes('[class*="transition"]'))
+ .map((r) => r.selectors.join(", "));
+}
+
+test("the checker flags a nonzero blanket duration and accepts 0s", () => {
+ const bad = "html.force-reduced-motion *,\nhtml.force-reduced-motion *::before { transition-duration: 0.01ms !important; }";
+ assert.deepEqual(implicitTransitionBlankets(bad), ["html.force-reduced-motion * { transition-duration: 0.01ms }"]);
+ const media = "@media (prefers-reduced-motion: reduce) { html:not(.force-motion) * { transition-duration: 1ms !important; } }";
+ assert.deepEqual(implicitTransitionBlankets(media), ["html:not(.force-motion) * { transition-duration: 1ms }"]);
+ const good = "html.force-reduced-motion * { transition-duration: 0s !important; }\n.x * { transition-duration: 1s; }";
+ assert.deepEqual(implicitTransitionBlankets(good), []);
+});
+
+test("neither Reduce motion blanket turns on transitions for every element", () => {
+ const css = read("src/index.css");
+ for (const blanket of BLANKETS) {
+ assert.ok(rules(css).some((r) => r.selectors.includes(blanket)), `${blanket} block not found`);
+ }
+ assert.deepEqual(implicitTransitionBlankets(css), []);
+});
+
+test("both blocks keep 0.01ms for class-declared transitions and every overlay native-view.ts follows", () => {
+ const css = read("src/index.css");
+ const found = exemptions(css);
+ assert.equal(found.length, 2, `one exemption per Reduce motion block, found: ${JSON.stringify(found)}`);
+ assert.ok(found.some((s) => s.startsWith("html.force-reduced-motion ")));
+ assert.ok(found.some((s) => s.startsWith("html:not(.force-motion) ")));
+ // native-view.ts measures these overlays while their transitions run; at 0s none would fire.
+ const nativeView = read("src/features/browser/native-view.ts");
+ const clickable = nativeView.match(/const CLICKABLE_SELECTOR =\s*"([^"]+)"/);
+ assert.ok(clickable, "CLICKABLE_SELECTOR not found in native-view.ts");
+ for (const part of clickable[1].split(",").map((s) => s.trim())) {
+ for (const s of found) assert.ok(s.includes(part), `${part} missing from: ${s}`);
+ }
+});
diff --git a/tests/studio/_area_matrix.py b/tests/studio/_area_matrix.py
index d166a978110..3f42012a4e2 100644
--- a/tests/studio/_area_matrix.py
+++ b/tests/studio/_area_matrix.py
@@ -109,6 +109,10 @@ KNOWN_DEFAULT = ",".join(
+ [f"{m}:thread_scroll=7" for m in _GLASS_MODES]
+ [f"{m}:settings_scroll=7" for m in _GLASS_MODES]
+ [f"{m}:type=6" for m in _GLASS_MODES]
+ # Opening Settings restyles elements across the thread, on main too (fresh pages, default
+ # appearance: 1,975 -> 9,721 elements at 40 -> 200 turns, 4.9x). Reduce motion's blanket
+ # transitions used to add ~3,800 elements to the gate's 40 turn reading, which hid the growth.
+ + ["length:settings=5"]
)
KNOWN = os.environ.get("LONG_THREAD_AREAS_KNOWN", KNOWN_DEFAULT)