Repository navigation
Desktop: fix the mobile-layout fallout of Windows text scaling - #7927
Merged
Merged
Conversation
Windows text scaling multiplies WebView2's device scale factor, so the desktop app can land in the mobile layout in an ordinary window: at 250% display scaling plus 125% text scaling the effective CSS DPR is 3.125, and the app's own 900px minimum window is only ~722 CSS px -- under MOBILE_BREAKPOINT (768). Two controls broke there, and neither is Windows-specific in principle: - The titlebar's sidebar toggle calls togglePinned, which the sidebar ignores in mobile mode (the sheet is keyed off openMobile), so the button looked dead. Hold the slot open instead of rendering a toggle that cannot work, keeping back/forward in place. - Navbar's SidebarTrigger -- the control that does work there -- sits at z-[45] under the custom titlebar's z-[70] header, leaving ~11px of it clickable. Move it into the titlebar band, above it. Also stop SettingsRow from crushing its label: the controls are fixed-width and shrink-0, so a narrow content column starved the label to one word per line. Wrap instead. The dialog reserves 248px of nav plus padding, so this is reachable well before any viewport-width breakpoint fires. Every branch is guarded on shouldUseCustomWindowTitlebar() or is width driven, so macOS, Linux and the web keep their existing layout.
First launch sizes the window from logical px, but Windows text scaling zooms the webview on top of the display scale, so logical px buy fewer CSS px than they look like. On a 2880x1800 panel at 250% scaling with text scaling at 125% the CSS device pixel ratio is 3.125, the 0.75-of-screen rule lands on 864 logical px, and the window opens at 691 CSS px: under the 768 sidebar breakpoint, so a normal desktop window came up in the mobile layout. Clamp the first-launch width up to whatever buys 768 CSS px, bounded by the screen. devicePixelRatio already includes the display scale, so the ratio is 1 and this is a no-op wherever there is no extra webview zoom.
This was referenced Aug 5, 2026
danielhanchen
added a commit
to danielhanchen/unsloth-staging-2
that referenced
this pull request
Aug 5, 2026
Collaborator
|
@codex review |
danielhanchen
added a commit
to shimmyshimmer/unsloth-staging-4
that referenced
this pull request
Aug 5, 2026
|
Codex Review: Didn't find any major issues. Hooray! 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". |
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, 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". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Reported on Windows 11: the sidebar toggle in the titlebar does nothing in a normal window (a second control lower down works), and the Settings rows for Hugging Face token and Embedding model are badly misaligned. Maximizing the window fixes both.
Both are the same root cause, and it is not a Windows-only concern in principle.
Windows text scaling multiplies the webview's device scale factor. On the reporting machine, a 2880x1800 panel at 250% display scaling with
HKCU:\Software\Microsoft\Accessibility\TextScaleFactor = 125gives an effective CSS device pixel ratio of 3.125, not 2.5. Measured, not assumed: the sidebar is17.5rem= 280 CSS px and renders 873 physical px.So the app's 900 logical px minimum window is only about 722 CSS px, which is under
MOBILE_BREAKPOINT = 768inhooks/use-mobile.ts. The desktop app renders its mobile layout in an ordinary window. Maximized gives 1152 logical, about 924 CSS px, which is why maximizing appears to fix it.Two controls break there:
togglePinned. In mobile mode the sidebar is a sheet keyed offopenMobileand pin state does nothing, so the button focuses, shows its tooltip, and has no effect.SidebarTrigger, the control that does work, sits atz-[45]under the custom titlebar'sz-[70]header. Only about 11px of it is clickable, which is the sliver users find by accident.Confirmed by driving the shipped app: clicking that sliver opens the mobile sheet.
Changes
components/tauri/window-titlebar.tsx- newshowSidebarToggleprop, defaulttrue. In the mobile layout an inert same-size spacer holds the slot so back/forward keep their position, instead of rendering a toggle that cannot work.components/navbar.tsx- when the custom titlebar is in use, the mobileSidebarTriggermoves into the titlebar band atz-[80], where the desktop toggle would have been. One control, in the expected place, that works.app/provider.tsx- first launch clamps the window width up to whatever buys 768 CSS px, bounded by the screen. The oldmax(900, screenW * 0.75)rule lands on 864 logical = 691 CSS px on the reporting machine, so the app opened in the mobile layout by construction.devicePixelRatioalready includes the display scale, so the ratio is 1 and this is a no-op wherever there is no extra webview zoom.This is deliberately first launch only. An existing install takes the
restoreStateCurrentpath, so a window already saved under the breakpoint stays there. Clamping that path too would override a size the user chose on purpose, and would have to fight the plugin's maximized-state restore. The two changes above are what make that case usable, and maximizing or widening still escapes it.features/settings/components/settings-row.tsx- the row wraps instead of crushing the label. Controls are fixed-width andshrink-0, so a narrow content column starved the label. The settings dialog reserves 248px of nav plus 48px of padding, so this is reachable well before any viewport-width breakpoint fires.Note
justify-endrather than an auto margin on the control. Three callers (appearance-tab.tsx:76,resources-tab.tsx:579,general-tab.tsx:642) override the row toflex-col items-stretch. On a column axis an auto cross-axis margin suppressesalign-self: stretchper CSS Flexbox 9.4/9.6, which would have shrink-to-fit the folder input and the embedding-model combobox instead of letting theirw-fullspan the row.resources-tab's override ismax-[840px], so that branch is live exactly at the reporting width.Verification
Measured with real rendering, comparing
origin/mainagainst this branch in a harness that reproduces the settings dialog shell (min(960px, 100vw-2rem)dialog, 248px nav,p-6main).Label column width and line count for the two rows in the bug report:
43px for a label reading "Hugging Face token" is the reported bug.
No regression above the bug width: at 924 and 1400 every measured row is geometrically identical to
origin/main, includingwrappedstate and the stretch probe on theflex-colcallers. The label floor is11remspecifically because it is the widest value that keeps that true.12remand13remboth made the Models folder row wrap at 924, which is the maximized width on the reporting machine.tsc -bclean.npm run buildclean. Biome againstorigin/mainon these four files: one addeduseBlockStatements, from a braceless early return matching the 23 already inprovider.tsx. Biome is non-blocking in this repo by design.Cross-platform
Every branch is guarded or width-driven.
navbar.tsx: the non-custom-titlebar path keepsz-[45] h-[48px] items-start pt-[11px] pl-2verbatim.shouldUseCustomWindowTitlebar()is false when not in Tauri and false on macOS, so plain web and macOS are untouched.window-titlebar.tsx:showSidebarToggledefaults to true and the macOS caller inapp-sidebar.tsx:1729does not pass it. The only site passingfalseis insideWindowTitlebar, itself gated onshouldUseCustomWindowTitlebar(), and then only when mobile.provider.tsx: ratio is 1 without extra webview zoom, so the computed width is unchanged elsewhere.settings-row.tsx: the only unguarded file, hence the measurement table above.Not verified
The titlebar and window-sizing changes need a desktop build to confirm end to end; only the settings-row geometry could be measured directly. The Tauri Linux debug build in CI covers compilation.