Skip to content

Desktop: keep slide-in panels below the custom titlebar - #7954

Merged
danielhanchen merged 5 commits into
unslothai:mainfrom
oobabooga:fix/studio-sheet-titlebar-overlap
Aug 7, 2026
Merged

danielhanchen merged 5 commits into
unslothai:mainfrom
oobabooga:fix/studio-sheet-titlebar-overlap

Conversation

@oobabooga

@oobabooga oobabooga commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Problem

In the packaged Studio desktop app on Windows and Linux, certain slide-in panels open partly behind the app's opaque custom titlebar. The top 34px of the panel is covered, leaving its title and close button partly hidden.

Still affected on main: chart settings, and the sidebar and run settings panels at mobile-layout widths. Response details, RAG document preview and deep research hit the same bug but each carries its own local offset, which this PR replaces. Browser mode and macOS are unaffected.

Reproduction

  1. Open the packaged Studio desktop app on Windows or Linux.
  2. Open chart settings, or the sidebar or run settings panel at a width that uses the mobile layout (reachable on desktop under Windows text scaling, see Desktop: fix the mobile-layout fallout of Windows text scaling #7927).
  3. The panel starts at the top of the window instead of below the titlebar, leaving its header and close control clipped.

Root cause

Studio implements these slide-in panels with a shared UI component called SheetContent. The custom titlebar is 34px tall and renders above the panels. Fixed panels still start at top: 0 and fill the viewport, so the titlebar covers their upper edge.

Radix renders the panels under document.body, outside the desktop chrome wrapper, so they cannot inherit the titlebar height variable defined there. #7957 solved that by mirroring the variable onto <html>, then offset two panels individually. The remaining panels, and any panel added later, still start at top: 0.

Fix

  • Read the mirrored --studio-custom-titlebar-height in SheetContent, so one place offsets every fixed panel. It is unset in the browser and on macOS, where the 0px fallback applies.
  • Apply the inset to fixed panels that open from the top, left, or right.
  • Anchor left and right panels with explicit top and bottom edges so they still end at the viewport bottom.
  • Leave bottom panels and panels contained inside another element unchanged.
  • Remove the now-redundant local compensation from deep research, Response details and RAG document preview.
  • Add a focused desktop contract test.

Caller-provided inline styles still take precedence. The overlay remains full-viewport, and the docked chat settings panel keeps its existing in-tree offset.

Screenshots

Before

sheet-titlebar-overlap-before

After

sheet-titlebar-overlap-after

Testing

  • python3 -m pytest tests/studio/test_desktop_reliability_frontend_contract.py -q (26 passed; test_desktop_titlebar_separates_navigation_from_sidebar_brand fails identically on main)
  • npm test (724 passed)
  • npm run typecheck
  • git diff --check

Runtime validation

Built and ran a Linux AppImage containing this change.

  • On main before Studio: center sheet header close buttons #7957 added its per-panel offsets, the Response details panel started at the top of the window, underneath the custom titlebar. Its title and close button were clipped.
  • With this change, the panel starts immediately below the 34px titlebar and still ends at the bottom of the window. The complete header and close button are visible.

The regression test covers the <html> mirror, fixed-panel inset conditions, edge anchoring, and removal of the local offsets.

@oobabooga oobabooga changed the title Studio: keep slide-in panels below the custom titlebar Desktop: keep slide-in panels below the custom titlebar Aug 5, 2026
@danielhanchen
danielhanchen force-pushed the fix/studio-sheet-titlebar-overlap branch from 2416cdd to 5771975 Compare August 6, 2026 15:19
@danielhanchen

Copy link
Copy Markdown
Member

#7957 landed first, and it turned out to carry its own compensation for this same overlap. I rebased this branch onto current main and removed the duplicate, so the two do not stack. Force-pushed to fix/studio-sheet-titlebar-overlap, sorry for touching your branch directly.

What collided

#7957 added a DesktopChromeVarsEffect that mirrors --studio-custom-titlebar-height onto <html>, plus a per-sheet marginTop and height: calc(100% - ...) on the response details and document preview sheets. That was the narrow version of what SheetViewportInsetProvider does properly here.

With both live, those two panels get top: 34px from the context and another 34px of marginTop from their own style:

Variant top bottom viewport
Both mechanisms 68px 834px 800px
This branch 34px 800px 800px

So they started 68px down and hung 34px past the bottom.

What I changed on top of your commit

  • Dropped the marginTop / height pair from message-response-details-sheet.tsx and document-preview-sheet.tsx.
  • Deleted DesktopChromeVarsEffect and its three mount points. Once no portalled sheet reads those vars it is dead: every remaining consumer (navbar.tsx, window-titlebar.tsx, the docked chat-settings-sheet.tsx aside, chat-page.tsx) renders inside the chrome div and inherits normally.
  • Extended test_fixed_sheets_start_below_the_custom_titlebar to assert no sheet reads the height and that the effect is gone, so the two mechanisms cannot come back.

Your approach is the right one, it just needed to be the only one.

Verification

189 measurements, chromium/firefox/webkit x the custom-titlebar, macOS and browser branches x all seven SheetContent call sites x UI font 12/15/20, driving the real SheetContent and SheetViewportInsetProvider:

  • top is 34px on the Windows/Linux path and 0px on macOS and in the browser, for all six viewport-fixed sites.
  • bottom equals the viewport height everywhere, so the top-0 bottom-0 swap holds.
  • The recipe-studio block sheet (position="absolute" with a container) stays glued to its container and never picks up the inset.
  • The one site that reports an unreachable close button is the mobile sidebar, which sets [&>button]:hidden, so the button is display: none at 0x0. Pre-existing and unrelated.

npm run typecheck, npm run build, npm test (706 passed), and pytest tests/studio (2666 passed) are all clean. The single failure there, test_desktop_titlebar_separates_navigation_from_sidebar_brand, already fails on main and is unrelated to this PR.

@danielhanchen

Copy link
Copy Markdown
Member

pre-commit.ci run

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 5771975dcb

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

@danielhanchen
danielhanchen force-pushed the fix/studio-sheet-titlebar-overlap branch from 5771975 to 55ebf13 Compare August 6, 2026 16:12
@danielhanchen

Copy link
Copy Markdown
Member

Rebased onto current main again, which moved under us. Two things changed in the resolution, one of them a correction to what I pushed earlier.

#8016 makes DesktopChromeVarsEffect load-bearing

My previous push deleted DesktopChromeVarsEffect on the grounds that nothing portalled read the vars once the sheets stopped compensating. #8016 has since given it a second job: it also mirrors --studio-window-chrome-top, which components/ui/dialog.tsx, components/ui/alert-dialog.tsx and features/settings/settings-dialog.tsx read for their own top clearance, and those all portal to body.

So deleting it would have broken desktop dialog positioning. It is restored, along with all three of its mount points, and the contract test no longer asserts it is gone. This branch now only removes the per-sheet compensation, which is the part that actually double-offsets.

Class list merge with #8016

#8016 added data-[side=top]:max-h-[85dvh], data-[side=bottom]:max-h-[85dvh] and the matching overflow-y-auto to SheetContent. Those are kept; this PR's inset-y-0 h-full to top-0 bottom-0 swap for the left and right sides is applied on top of them.

State

  • npm run typecheck, npm run build, npm test (724 passed) clean on the rebased tree.
  • Contract tests: 33 passed. The one failure, test_desktop_titlebar_separates_navigation_from_sidebar_brand, already fails on main and is unrelated; it asserts a lucide-react import that window-titlebar.tsx no longer has.
  • Geometry re-verified after the rebase: on the Windows and Linux path every fixed sheet starts at 34px and still ends at the viewport bottom, on macOS and in the browser they start at 0, and the recipe-studio in-container sheet is untouched.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 55ebf13f6c

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

danielhanchen added a commit to oobabooga/unsloth that referenced this pull request Aug 6, 2026
oobabooga and others added 4 commits August 7, 2026 04:17
…s landed

unslothai#7957 merged first and gave the response details and document preview
sheets their own compensation for the same overlap: a marginTop plus
height: calc(100% - var(--studio-custom-titlebar-height)).

With SheetViewportInsetProvider both apply, pushing those two panels to
68px and leaving them 34px past the viewport bottom. Remove the per-sheet
compensation so the context is the only offset for sheets, and extend the
contract test to pin that.

DesktopChromeVarsEffect stays: unslothai#8016 gave it a second job, mirroring
--studio-window-chrome-top for the dialogs that portal to body.
@danielhanchen
danielhanchen force-pushed the fix/studio-sheet-titlebar-overlap branch from cb764ae to 456d14d Compare August 7, 2026 04:23
@danielhanchen

Copy link
Copy Markdown
Member

Your CSS-variable approach is better than the context, and I verified it. Also rebased onto current main, which clears every red check.

The redesign holds up

DesktopChromeVarsEffect has to exist anyway for --studio-window-chrome-top, so reading --studio-custom-titlebar-height off <html> instead of threading a context is strictly less machinery, and it leaves provider.tsx untouched.

One thing I specifically checked, because arbitrary-value variants with a comma inside var() are exactly where Tailwind tends to bail: the class is generated correctly.

.data-\[side\=left\]\:top-\[var\(--studio-custom-titlebar-height\,0px\)\][data-side=left]{top:var(--studio-custom-titlebar-height,0px)}

All three sides are present, and VIEWPORT_TOP_EDGE and CONTAINED_TOP_EDGE are mutually exclusive, so the two same-specificity rules never race.

Geometry, 378 measurements across chromium, firefox and webkit x the custom-titlebar, macOS and browser branches x all seven SheetContent call sites x UI font 12/15/20:

chrome sites 1-5, 7 site 6 (in-container)
custom (Windows, Linux) top 34 top 34, from the route padding
mac top 0 top 34, from the route padding
browser top 0 top 0

bottom equals the viewport height on every row. The control arm, with the per-sheet compensation still present, reproduces the double offset at top 68, bottom 834 against an 800px viewport.

The red checks were staleness, not this PR

The branch was 13 commits behind main. Both failure clusters are already fixed there:

After the rebase: contract tests 34 passed, 0 failed. npm run typecheck, npm run build, npm test (729 passed) all clean.

The Chat UI Tests red was a different thing again, a chat queueing assertion ("follow-up sent during a held first turn did not appear as queued work"), nothing to do with sheets. Watching whether it survives the rebase.

@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@danielhanchen

Copy link
Copy Markdown
Member

Cross-OS results are in, on real Windows, macOS and Linux runners. All three green, 420 measurements, zero violations.

runner engines rows fixed rows violations
windows-latest chromium, msedge 112 56 0
macos-14 chromium 56 28 0
ubuntu-latest chromium, firefox, webkit 252 126 0

msedge on Windows is the same Chromium family as the WebView2 runtime the packaged app actually uses, so that leg exercises the real desktop engine with real Segoe UI metrics.

Every viewport-fixed sheet starts at 34px on the custom-titlebar path and 0px on macOS and in the browser; bottom equals the viewport height on every row; the recipe block sheet keeps tracking its own container. The control arm, with the per-sheet compensation still present, reproduces the double offset at top 68, bottom 834 against an 800px viewport on both Windows and Linux.

One gap worth stating rather than glossing: WebKit timed out on macos-14 and was skipped, so the macOS leg is chromium only. That is the known Playwright-on-macos-14 problem this repo already pins around in studio-mac-ui-smoke.yml, not something about this change. Real WKWebView coverage is Linux WebKit plus macOS Chromium, not a genuine Safari-on-macOS run.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 456d14deb6

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

@danielhanchen
danielhanchen merged commit bbbbaae into unslothai:main Aug 7, 2026
28 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants