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.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: modal opens stop re-laying out long chats in WebKit (#17284)
Daniel Han68399c7b81a5
diff --git a/studio/frontend/src/app/routes/__root.tsx b/studio/frontend/src/app/routes/__root.tsxindex 153d53fcecf..22ad15c1eca 100644--- a/studio/frontend/src/app/routes/__root.tsx+++ b/studio/frontend/src/app/routes/__root.tsx@@ -710,7 +710,7 @@ function RootLayout() {<ImageViewer />{!hideNavbar && <CommandPalette />}{hideNavbar ? (- <main className="flex-1 pt-[var(--studio-hidden-route-top-inset,0px)] [--studio-titlebar-height:var(--studio-hidden-route-top-inset,0px)]">+ <main className="h-dvh flex-1 overflow-y-auto pt-[var(--studio-hidden-route-top-inset,0px)] [--studio-titlebar-height:var(--studio-hidden-route-top-inset,0px)]"><RouteBoundary readyWhenCommitted={!routeOwnsReloadReadiness}><Outlet /></RouteBoundary>diff --git a/studio/frontend/src/features/hub/hub.css b/studio/frontend/src/features/hub/hub.cssindex 7775aa812eb..ea188d37b1e 100644--- a/studio/frontend/src/features/hub/hub.css+++ b/studio/frontend/src/features/hub/hub.css@@ -1548,11 +1548,8 @@ html.dark .hub-page [data-hub-scroll="true"]::-webkit-scrollbar-thumb {background: oklch(0.55 0 0 / 0.16);}-/* Radix modals set body[data-scroll-locked]; re-disable the pointer-events-auto opt-ins so- their tooltips do not fire behind the dialog. */-body[data-scroll-locked] .hub-modal-pe-guard {- pointer-events: none !important;-}+/* .hub-modal-pe-guard goes inert behind a modal via region-keyed rules in index.css: a+ body[data-scroll-locked] descendant rule made WebKit re-match a long chat on every modal toggle. *//* Model filter ranges: two thumbs share a track, so smaller than a single slider. */.hub-range {diff --git a/studio/frontend/src/index.css b/studio/frontend/src/index.cssindex e1fbb15cfdb..c6f10d7f2d8 100644--- a/studio/frontend/src/index.css+++ b/studio/frontend/src/index.css@@ -2154,6 +2154,15 @@ html[data-chat-font] .aui-root {body {--removed-body-scroll-bar-size: 0px;}+ /* The scroll lock's body styles, preset on screen: flipping them re-laid out the whole page in WebKit+ (20-30 ms per modal at 150 turns). Safe because the page never scrolls itself (views sit in h-full+ html, body and #root); print keeps document flow. */+ @media screen {+ body {+ overflow: hidden;+ position: relative;+ }+ }/* Radix modal layers (dialogs, modal menus, selects) write pointer-events: none on <body>.That property is inherited, so every open and close restyled each element of the chat:diff --git a/studio/frontend/tests/modal-pointer-lock.test.ts b/studio/frontend/tests/modal-pointer-lock.test.tsindex 49e2a919946..ac2491404b9 100644--- a/studio/frontend/tests/modal-pointer-lock.test.ts+++ b/studio/frontend/tests/modal-pointer-lock.test.ts@@ -9,6 +9,10 @@import assert from "node:assert/strict";import test from "node:test";+import { readdirSync, readFileSync } from "node:fs";+import { join } from "node:path";+import { fileURLToPath } from "node:url";+import { readSrc } from "./helpers/kit.ts";type Init = { childList?: boolean; attributes?: boolean; subtree?: boolean; attributeFilter?: string[] };@@ -170,6 +174,61 @@ test("no modal rule keys on an inline style, and lock attributes above a threadassert.match(readSrc("main.tsx"), /watchModalPointerLock\(document\);/);});+test("no stylesheet keys a descendant rule on an attribute a modal toggles above the chat", () => {+ // These attributes toggle above every message on each modal; keyed before a combinator, WebKit re-matches the chat.+ const root = fileURLToPath(new URL("../src/", import.meta.url));+ const sheets = readdirSync(root, { recursive: true, encoding: "utf8" }).filter((f) => f.endsWith(".css"));+ assert.ok(sheets.length > 1, "stylesheets found");+ const toggled = ["data-scroll-locked", "aria-hidden", "data-aria-hidden"];+ const offenders: string[] = [];+ for (const file of sheets) {+ const css = readFileSync(join(root, file), "utf8").replace(/\/\*[\s\S]*?\*\//g, "");+ for (const block of css.split("}")) {+ const prelude = block.slice(0, block.lastIndexOf("{") >= 0 ? block.lastIndexOf("{") : 0);+ for (const selector of splitTopLevel(prelude)) {+ for (const attr of toggled) {+ const re = new RegExp(`\\[${attr}(?:[\\]=~|^$*]|\\])`, "g");+ for (let m = re.exec(selector); m; m = re.exec(selector)) {+ if (combinatorAfter(selector, m.index)) offenders.push(`${file}: ${selector.trim()}`);+ }+ }+ }+ }+ }+ assert.deepEqual(offenders, []);+});++function splitTopLevel(prelude: string): string[] {+ const out: string[] = [];+ let depth = 0;+ let start = 0;+ for (let i = 0; i < prelude.length; i++) {+ const ch = prelude[i];+ if (ch === "(" || ch === "[") depth += 1;+ else if (ch === ")" || ch === "]") depth -= 1;+ else if (ch === "," && depth === 0) {+ out.push(prelude.slice(start, i));+ start = i + 1;+ }+ }+ out.push(prelude.slice(start));+ return out.map((s) => s.trim()).filter((s) => s && !s.startsWith("@"));+}++function combinatorAfter(selector: string, at: number): boolean {+ let depth = 0;+ let i = selector.indexOf("]", at) + 1;+ for (; i < selector.length; i++) {+ const ch = selector[i];+ if (ch === "(" || ch === "[") depth += 1;+ else if (ch === ")" || ch === "]") {+ depth -= 1;+ if (depth < 0) return false; // the attribute sits inside :is() / :not(): its own compound decides+ } else if (depth === 0 && /[\s>+~]/.test(ch)) return /\S/.test(selector.slice(i));+ }+ return false;+}+test("nothing is marked until the body lock goes up", () => {assert.deepEqual(marked(), {});});diff --git a/studio/frontend/tests/webkit-modal-page-restyle.test.ts b/studio/frontend/tests/webkit-modal-page-restyle.test.tsindex 8a2f9b70582..9a9bc48113b 100644--- a/studio/frontend/tests/webkit-modal-page-restyle.test.ts+++ b/studio/frontend/tests/webkit-modal-page-restyle.test.ts@@ -55,6 +55,25 @@ test("the lock's body styles are static, with what react-remove-scroll-bar injec}});+test("on screen <body> already has the lock's overflow and position, so a lock toggle is a no-op", () => {+ const css = readSrc("index.css");+ assert.match(+ css,+ /@media screen \{\s*body \{\s*overflow: hidden;\s*position: relative;\s*\}\s*\}/,+ );+ const lock = rule(css, "body[data-scroll-locked]");+ assert.ok(lock.includes("overflow: hidden !important;") && lock.includes("position: relative !important;"));+});++test("the login and change-password pages scroll in their own <main>, now that <body> never does", () => {+ const hiddenRouteMain = /<main className="([^"]*--studio-hidden-route-top-inset[^"]*)"/.exec(+ readSrc("app/routes/__root.tsx"),+ );+ assert.ok(hiddenRouteMain, "the hidden-navbar <main> is gone");+ const classes = hiddenRouteMain[1].split(" ");+ assert.ok(classes.includes("h-dvh") && classes.includes("overflow-y-auto"), hiddenRouteMain[1]);+});+test("document pointer listeners are pinned once per type, before the app mounts", () => {const added: [string, unknown][] = [];const target = {