Repository navigation
Studio: scale padding, icons and widths with the UI font size, and make interface scale work in the browser - #11648
Conversation
…ke interface scale work in the browser UI font size moved text but left a lot of the geometry around it fixed: - Icons grew at half the rate of text above the default, so a 20px label sat beside an 18px glyph. - About 290 arbitrary lengths (w-[232px], size-[15px], max-w-[15rem]) skipped --ui-space-scale. - Hub action buttons, the download button and badge, composer buttons, account menu rows and the panel slider thumb had fixed sizes in CSS. - Named widths (max-w-md, max-w-xs) stayed put while their content grew. Icons now scale linearly with --ui-font-scale, every arbitrary length above 3px goes through --ui-space-scale, and --container-* scales too. @container thresholds are inlined at build time, so breakpoints do not move. Hairlines, images, the desktop titlebar band and the token activity grid (measured in JS) stay fixed. Interface scale was desktop only. In the browser it now multiplies --ui-font-scale via --ui-interface-scale, so text, spacing and icons resize together. Root CSS zoom was not used: it inflates viewport units, so a 100dvh shell overflows at 125%. The row and its search entry now show on every build.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
… trailing inset - The system prompt and chat template editors scaled min-height past their dvh max-height. CSS lets min win, so at 200% a 40rem minimum beat a 23rem cap and the dialog scrolled instead of the field. The minimum is now min(scaled, cap). - Popover and select minimum widths get the same cap as the surfaces (100vw - 32px), and the model load status stops at its container. - Railed sidebar rows scaled their leading inset but not the trailing one. Both scale now; only the measured scrollbar rail stays fixed.
|
@codex review |
|
@codex review |
|
@codex review |
|
@codex review |
|
@codex review |
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
A full tests/studio run on main turned up five more contracts and two Playwright drivers pinned to spellings those two PRs changed on purpose: - test_update_release_notes: the update banners are 448px at the default scale, now written scale-wrapped; widths are read back through the scale before comparing. - test_ui_font_scale_contract: the CSS default lives in the fallback of the derived --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate. - test_chat_response_details_ui_contract: response details record Code from the placement actually sent, hosted sandbox or local tools (unslothai#11628). - playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc() and an unregistered custom property reads back as that text, so float() failed ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare could no longer fail. Both resolve the scale through a length instead.
…lacement in the studio contracts (unslothai#11673) * Follow unslothai#11648's UI-scale layout in four studio contract tests unslothai#11648 merged with Repo tests (CPU, studio) red, and main has failed those four since: - The Images and Audio rails are now min(408px, 100% - 13rem) at the default scale, so the canvas keeps the 13rem its header column reserves. Both pages pin that exact expression through a shared RAIL_WIDTH, so they still have to match each other. - The settings dialog stacks on its own measured width (data-stacked) rather than the max-sm viewport breakpoint, which a larger interface scale does not move. The test now requires the attribute to be set and the stacking class keyed on it. - The Thinking caret is 15px at the default scale in either spelling, since the composer's lengths are now wrapped in the space scale. * Cover the rest of unslothai#11648's and unslothai#11628's studio fallout A full tests/studio run on main turned up five more contracts and two Playwright drivers pinned to spellings those two PRs changed on purpose: - test_update_release_notes: the update banners are 448px at the default scale, now written scale-wrapped; widths are read back through the scale before comparing. - test_ui_font_scale_contract: the CSS default lives in the fallback of the derived --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate. - test_chat_response_details_ui_contract: response details record Code from the placement actually sent, hosted sandbox or local tools (unslothai#11628). - playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc() and an unregistered custom property reads back as that text, so float() failed ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare could no longer fail. Both resolve the scale through a length instead. * Read the Code placement inside buildResponseDetails, not anywhere in the adapter * Pin the rail's scale wrapper as written, since the default-scale read cannot see it * Pin the scaled spelling of the Thinking caret and the update notes width * Read the font-size setter and the stacking attribute where they take effect
… next one, and re-measure the startup budget (unslothai#11676) prompt-storage-dialog and refresh-context-usage were loaded with import() at five sites while the startup set already imports both statically, so nothing was deferred. Rolldown reported both as INEFFECTIVE_DYNAMIC_IMPORT and a build warning is all it ever was. Importing them statically drops 2.2 KB raw from the eager set, and the build now throws on that log instead of printing it. That is not enough on its own: main measures 5,601.9 KB raw against the 5,595.7 KB ceiling. The eager set gained one 303-byte chunk since the last raise and otherwise grew inside chunks already eager, mostly unslothai#11607 and unslothai#11648, so the budget is re-measured with the margin unslothai#11013 chose.
… the update card's scaled width (unslothai#11700) * Read the sidebar pin's width default only where matchMedia exists unslothai#11660 made use-sidebar-pin read the lg media query when it is imported, without asking whether window.matchMedia exists. Frontend tests that reach the window titlebar supply a partial window with no matchMedia, so the import threw and failed training-dataset-source-transitions.test.ts on main. With nothing to ask, keep the desktop default, as the module already does when there is no window at all, and skip the width listener. * Expect the update card's scaled width at a larger UI size unslothai#11648 made the card's max width calc(448px * var(--ui-space-scale, 1)), so at the 20px UI size it is 597px, and the layout pass still wanted 448. The pass only reached that check once unslothai#11673 made its scale probe readable.
…ke interface scale work in the browser (unslothai#11648) * Studio: scale padding, icons and widths with the UI font size, and make interface scale work in the browser UI font size moved text but left a lot of the geometry around it fixed: - Icons grew at half the rate of text above the default, so a 20px label sat beside an 18px glyph. - About 290 arbitrary lengths (w-[232px], size-[15px], max-w-[15rem]) skipped --ui-space-scale. - Hub action buttons, the download button and badge, composer buttons, account menu rows and the panel slider thumb had fixed sizes in CSS. - Named widths (max-w-md, max-w-xs) stayed put while their content grew. Icons now scale linearly with --ui-font-scale, every arbitrary length above 3px goes through --ui-space-scale, and --container-* scales too. @container thresholds are inlined at build time, so breakpoints do not move. Hairlines, images, the desktop titlebar band and the token activity grid (measured in JS) stay fixed. Interface scale was desktop only. In the browser it now multiplies --ui-font-scale via --ui-interface-scale, so text, spacing and icons resize together. Root CSS zoom was not used: it inflates viewport units, so a 100dvh shell overflows at 125%. The row and its search entry now show on every build. * Studio: cap scaled minimums at their own maximum, and scale the row's trailing inset - The system prompt and chat template editors scaled min-height past their dvh max-height. CSS lets min win, so at 200% a 40rem minimum beat a 23rem cap and the dialog scrolled instead of the field. The minimum is now min(scaled, cap). - Popover and select minimum widths get the same cap as the surfaces (100vw - 32px), and the model load status stops at its container. - Railed sidebar rows scaled their leading inset but not the trailing one. Both scale now; only the measured scrollbar rail stays fixed. * Keep recipe dialogs under the viewport and scale the response sheet width * Cap scaled rails and menus against their containers * Stack the settings rail by scaled width and let composite controls shrink * Cap the scaled mobile run settings sheet at the viewport * Scale resizable panel widths in the browser and keep the training overlay reachable
…lacement in the studio contracts (unslothai#11673) * Follow unslothai#11648's UI-scale layout in four studio contract tests unslothai#11648 merged with Repo tests (CPU, studio) red, and main has failed those four since: - The Images and Audio rails are now min(408px, 100% - 13rem) at the default scale, so the canvas keeps the 13rem its header column reserves. Both pages pin that exact expression through a shared RAIL_WIDTH, so they still have to match each other. - The settings dialog stacks on its own measured width (data-stacked) rather than the max-sm viewport breakpoint, which a larger interface scale does not move. The test now requires the attribute to be set and the stacking class keyed on it. - The Thinking caret is 15px at the default scale in either spelling, since the composer's lengths are now wrapped in the space scale. * Cover the rest of unslothai#11648's and unslothai#11628's studio fallout A full tests/studio run on main turned up five more contracts and two Playwright drivers pinned to spellings those two PRs changed on purpose: - test_update_release_notes: the update banners are 448px at the default scale, now written scale-wrapped; widths are read back through the scale before comparing. - test_ui_font_scale_contract: the CSS default lives in the fallback of the derived --ui-font-scale, and icons scale linearly with it (unslothai#11648 said so), not at half rate. - test_chat_response_details_ui_contract: response details record Code from the placement actually sent, hosted sandbox or local tools (unslothai#11628). - playwright_chat_ui / playwright_update_banner_layout: --ui-font-scale is now a calc() and an unregistered custom property reads back as that text, so float() failed ('unreadable --ui-font-scale') and the banner's 'is it scaled' string compare could no longer fail. Both resolve the scale through a length instead. * Read the Code placement inside buildResponseDetails, not anywhere in the adapter * Pin the rail's scale wrapper as written, since the default-scale read cannot see it * Pin the scaled spelling of the Thinking caret and the update notes width * Read the font-size setter and the stacking attribute where they take effect
… next one, and re-measure the startup budget (unslothai#11676) prompt-storage-dialog and refresh-context-usage were loaded with import() at five sites while the startup set already imports both statically, so nothing was deferred. Rolldown reported both as INEFFECTIVE_DYNAMIC_IMPORT and a build warning is all it ever was. Importing them statically drops 2.2 KB raw from the eager set, and the build now throws on that log instead of printing it. That is not enough on its own: main measures 5,601.9 KB raw against the 5,595.7 KB ceiling. The eager set gained one 303-byte chunk since the last raise and otherwise grew inside chunks already eager, mostly unslothai#11607 and unslothai#11648, so the budget is re-measured with the margin unslothai#11013 chose.
… the update card's scaled width (unslothai#11700) * Read the sidebar pin's width default only where matchMedia exists unslothai#11660 made use-sidebar-pin read the lg media query when it is imported, without asking whether window.matchMedia exists. Frontend tests that reach the window titlebar supply a partial window with no matchMedia, so the import threw and failed training-dataset-source-transitions.test.ts on main. With nothing to ask, keep the desktop default, as the module already does when there is no window at all, and skip the width listener. * Expect the update card's scaled width at a larger UI size unslothai#11648 made the card's max width calc(448px * var(--ui-space-scale, 1)), so at the 20px UI size it is 597px, and the layout pass still wanted 448. The pass only reached that check once unslothai#11673 made its scale probe readable.
UI font size is meant to resize the whole interface, but a lot of the geometry around the text stayed put, and Interface scale only existed in the desktop app.
What was wrong
Icons grew at half rate.
--ui-icon-sizewasmin(1rem * scale, 0.5rem + 0.5rem * scale), so above the default an icon grew half as fast as the label beside it. At 20px that is a 20px label, an 18px glyph and padding sized for 20px.About 290 arbitrary lengths skipped the scale.
w-[232px],size-[15px],max-w-[15rem],min-h-[260px]and so on across the composer, menus, Hub, Settings, Train, Images, Video and Recipes. Tailwind'sp-*,gap-*andsize-*already go through--spacing, but arbitrary values do not.Fixed sizes in the stylesheets. Hub action buttons and their glyphs, the download button and its badge, the carousel fades, the composer's 28px buttons, the account menu rows, the welcome sloth and the panel slider thumb.
Named widths.
max-w-mdon a dialog ormax-w-xson a tooltip held its width while the text and padding inside grew.Interface scale was desktop only. The row was gated on
isTauri, and in the browserapplyInterfaceScaledid nothing.What changed
--ui-icon-sizeis1rem * var(--ui-font-scale), and the scoped icon rules for menus, selects, popovers, toasts and the thread drop the half-ratemin()too. Those rules match each arbitrary glyph size in both its plain and scaled spelling.calc(Npx*var(--ui-space-scale,1)). Left fixed on purpose: hairlines and 1 to 3px nudges, images (they stage content at their own size), the desktop titlebar band (OS window chrome), and the token activity grid, whose cells and gaps are measured in JS.index.cssandhub.csstake the same multiplier. The carousel fade offsets scale with the-mx-2bleed they line up with.--container-*scales, declared outside@theme. Utilities read it at runtime, while Tailwind inlines the literal into every@containerquery, so layout breakpoints do not move.--ui-font-scalethrough--ui-interface-scale. Spacing and icons derive from that, so everything resizes as one.useUiSpaceScaleincludes it for the JS-measured slots. Root CSSzoomwas not an option: it inflates viewport units, and a100dvhshell measured 1280x960 in a 1024x768 window at 125%. The desktop app keeps its webview zoom and gets a factor of 1.min-heightwin overmax-height, so the system prompt and chat template editors aremin(calc(20rem * scale), 48dvh)against their48dvhcap, and popover and select minimum widths stop at the surfaces'100vw - 32px.max-hdropsDialogContent's own viewport cap (tailwind-merge keeps the last one), so the scaled Recipes config, import, preview and processors dialogs restate it:min(calc(650px * scale), 100dvh - chrome - 2rem). At 160% on an 800px window they stop at 768px instead of 1040px.w-[min(28rem, 100vw)]width, not only itsmax-w, so it actually widens (448px to 717px at 160%). The mobile run settings sheet keeps its scaled 18rem but stops at100vw: at 200% on a 375px phone it was 576px and started 201px off-screen.100% - 13rem, so a large scale cannot push the preview out of its split (at 20px + 200% the rail was 1088px in an 800px split). The Images and Audio header columns scale the same way, so their dividers stay over the rail.sm, a viewport breakpoint, so at 200% a 1000px window kept a 480px pane and controls ran out of it. The dialog now stacks when it is narrower than 608px (its width atsm) times the UI scale; at 100% that ismax-smexactly. The full-screen dialog shell stays on the viewport breakpoint.Rendering all 14 Settings tabs and checking every element against its pane: at 200% with a 480px pane, 9 tabs overflowed (by up to 367px). With the changes above, none overflow at 20px + 200% on a full-width pane, at 150% on the narrowest pane that stays side by side (540px), or at 100% on a 360px pane.
min(preferred, var(--radix-*-content-available-height))), so a long list scrolls within the viewport instead of running offscreen. Applies to the Train base picker, the Images size menu and the dictation device select.Measured
Setup screen, px:
Every column moves by the same factor, and there is no horizontal overflow at 20px + 125% in a 1280px window.
Testing
npm run typecheckclean,npm test8525 passing,npm run buildclean.New tests in
ui-font-size-scales-spacing.test.ts:--container-*stays out of@themesrcsrcsidebar-width.test.tsadds a case for the scaled window cap.interface-scale.test.tscovers the browser path: the variable is set, removed at 100%, clamped at the floor, and left alone on desktop.Ten existing tests pinned literal class names or the desktop-only row. Each keeps its guarantee against the scaled spelling:
connected-model-row-actions,find-in-page,model-picker-partial-downloads,research-activity-visuals,update-banner-flex-priority: the literal now readscalc(...*var(--ui-space-scale,1))train-configure-preview-column: the page cap regex accepts the scaled form, read at the defaultsettings-search,interface-scale: the row is on every buildsidebar-action-rows-inert: the trailing row inset reads5px*var(--ui-space-scale,1)ui-font-size-scales-spacing:--ui-font-scaleis now derived from--ui-font-size-scaleand--ui-interface-scaleIndependent of the contrast slider PR. They touch different hunks of
index.css,appearance-custom-store.tsandreload-snapshot.jsand merge cleanly in either order.