Skip to content

Studio: scale padding, icons and widths with the UI font size, and make interface scale work in the browser - #11648

Merged
shimmyshimmer merged 7 commits into
mainfrom
studio-scale-padding-and-icons
Sep 23, 2026
Merged

shimmyshimmer merged 7 commits into
mainfrom
studio-scale-padding-and-icons

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

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-size was min(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's p-*, gap-* and size-* 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-md on a dialog or max-w-xs on 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 browser applyInterfaceScale did nothing.

What changed

  • Icons scale linearly: --ui-icon-size is 1rem * var(--ui-font-scale), and the scoped icon rules for menus, selects, popovers, toasts and the thread drop the half-rate min() too. Those rules match each arbitrary glyph size in both its plain and scaled spelling.
  • Arbitrary lengths above 3px take 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.
  • Stylesheet controls in index.css and hub.css take the same multiplier. The carousel fade offsets scale with the -mx-2 bleed they line up with.
  • --container-* scales, declared outside @theme. Utilities read it at runtime, while Tailwind inlines the literal into every @container query, so layout breakpoints do not move.
  • Interface scale in the browser multiplies --ui-font-scale through --ui-interface-scale. Spacing and icons derive from that, so everything resizes as one. useUiSpaceScale includes it for the JS-measured slots. Root CSS zoom was not an option: it inflates viewport units, and a 100dvh shell measured 1280x960 in a 1024x768 window at 125%. The desktop app keeps its webview zoom and gets a factor of 1.
  • The Interface scale row and its search entry now show on every build.
  • A scaled minimum never passes its own maximum. CSS lets min-height win over max-height, so the system prompt and chat template editors are min(calc(20rem * scale), 48dvh) against their 48dvh cap, and popover and select minimum widths stop at the surfaces' 100vw - 32px.
  • A call-site max-h drops DialogContent'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.
  • The response details sheet scales its w-[min(28rem, 100vw)] width, not only its max-w, so it actually widens (448px to 717px at 160%). The mobile run settings sheet keeps its scaled 18rem but stops at 100vw: at 200% on a 375px phone it was 576px and started 201px off-screen.
  • The Images, Audio and Video settings rails stop at 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.
  • The Settings dialog's tab rail stops at half the dialog. At 20px + 200% in a 650px window it was 661px in a 618px dialog, clipping the settings pane.
  • Settings stacks by scaled width. The rail moved above the pane only below 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 at sm) times the UI scale; at 100% that is max-sm exactly. The full-screen dialog shell stays on the viewport breakpoint.
  • Resizable panels scale in the browser. The sidebar and the run settings panel stored pixel widths that desktop webview zoom scales but the browser scale did not, so at 200% their contents doubled inside a 280px shell. Widths are now layout px: the panels render them times the browser scale, the drag handle converts pointer movement back (the edge stays under the pointer), and the 40% window cap is taken from the window at that scale. Desktop and 100% are unchanged (factor 1).
  • The training start overlay centers its column with auto margins, so a column taller than the overlay (the scaled terminal at 200%) starts at its top and scrolls with the page, instead of spilling 209px above it with the cancel button out of reach.
  • Composite Settings controls shrink inside their row: the Hugging Face token field, the log actions, the agents quantization label, and the GPU memory meter, which now wraps under the device name instead of running past it.

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.

  • Menu height caps keep Radix's available height (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.
  • Railed sidebar rows scale both insets; only the measured scrollbar rail stays fixed.

Measured

Setup screen, px:

setting heading label input height icon button padding card padding
default (15px) 22.5 13.1 36 16 16 20
12px 18 10.5 28.8 12.8 12.8 16
20px 30 17.5 48 21.3 21.3 26.7
scale 125% 28.1 16.4 45 20 20 25
20px + 125% 37.5 21.9 60 26.7 26.7 33.3

Every column moves by the same factor, and there is no horizontal overflow at 20px + 125% in a 1280px window.

Testing

npm run typecheck clean, npm test 8525 passing, npm run build clean.

New tests in ui-font-size-scales-spacing.test.ts:

  • no arbitrary length above a hairline skips the scale, outside the fixed-by-design files
  • icons grow at the rate of the text, and the half-rate curve is gone
  • named widths scale, and --container-* stays out of @theme
  • the Hub and panel slider controls follow the scale
  • a scaled minimum never outgrows its own cap
  • a sidebar row's inset scales on both sides
  • a scaled dialog keeps the viewport cap it replaces
  • the response details sheet scales its width, not only its cap
  • a scaled media rail leaves the preview its minimum
  • the settings rail never takes more than half the dialog
  • a menu's height cap keeps Radix's available height, checked across every menu content in src
  • settings stacks its rail where the scaled dialog is too narrow for it
  • composite settings controls shrink inside their row
  • a scaled sheet width stops at the viewport, checked across every sheet in src
  • resizable panels render their layout width at the browser scale
  • the training start overlay never spills above its host

sidebar-width.test.ts adds a case for the scaled window cap.

interface-scale.test.ts covers 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 reads calc(...*var(--ui-space-scale,1))
  • train-configure-preview-column: the page cap regex accepts the scaled form, read at the default
  • settings-search, interface-scale: the row is on every build
  • sidebar-action-rows-inert: the trailing row inset reads 5px*var(--ui-space-scale,1)
  • ui-font-size-scales-spacing: --ui-font-scale is now derived from --ui-font-size-scale and --ui-interface-scale

Independent of the contrast slider PR. They touch different hunks of index.css, appearance-custom-store.ts and reload-snapshot.js and merge cleanly in either order.

…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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-23T08:02:36.546481Z 41cd5eb Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

… 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.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 41cd5eb674

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@shimmyshimmer
shimmyshimmer merged commit 6eb1b2e into main Sep 23, 2026
51 of 58 checks passed
@shimmyshimmer
shimmyshimmer deleted the studio-scale-padding-and-icons branch September 23, 2026 10:07
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Sep 23, 2026
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.
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 23, 2026
…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
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 23, 2026
… 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.
Stanley00 pushed a commit to stanley-fork/unsloth that referenced this pull request Sep 23, 2026
… 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.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…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
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
…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
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
… 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.
shaojun pushed a commit to shaojun/unsloth that referenced this pull request Sep 29, 2026
… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants