Repository navigation
Studio: center sheet header close buttons - #7957
danielhanchen merged 3 commits into
Conversation
|
Thanks for this. I verified the alignment claim independently and it holds up exactly. Measured the signed delta between the close button's centre and the title's centre (positive means the button sits low), before and after, at each UI font size:
That reproduces your 4.750 and 6.625 to the digit. It holds on Chromium, Firefox and WebKit, and on ubuntu-latest, windows-latest and macos-14 runners, all within 0.02px (one LayoutUnit). Real Segoe UI and real SF Pro give identical numbers, since the line height is a unitless 1.5 ratio and so is font-metric independent. Header height, button size and the 16px right gap are all unchanged, exactly one close control renders per sheet, One thing to flag before this lands, on the desktop build only. The close button moves up, from Hit-testing a 9x9 grid over the button with
The centre of the button resolves to the window controls rather than to Close, both before and after. So the occlusion is pre-existing on main, not introduced here, but this change moves the button further into that band. macOS is unaffected because There is a wrinkle if you want to address it: the sheet is portalled to That takes Windows and Linux to 80.2 to 87.7% reachable with the centre hitting Close, leaves macOS and the browser build untouched since the variable resolves to Worth noting separately: Happy for the titlebar part to be a follow-up if you would rather keep this PR focused on the centring, which is correct as it stands. |
|
@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". |
…dow controls The two sheets start at the top of the viewport, so on Windows and Linux their header sits under the custom titlebar and its window-control toolbar, which paint above at z-70/z-80. Centring the close button on the title row moves it further into that band. Offset both sheets below the titlebar. The variable is set on the wrapper div, which portalled content cannot see, so mirror the titlebar heights onto <html> as well. Resolves to 0px in the browser and on macOS, which use native chrome.
|
Pushed the titlebar offset in c85482a so this does not need to be a follow-up. Two parts, because the obvious one alone does not work:
Measured on the pushed branch, hit-testing a 9x9 grid over the close button, where 85.2% is a fully clear round button:
The centre of the button now resolves to Close rather than to the window controls. Both sheets, at 12, 15 and 20px UI font. macOS and the browser build are untouched since the variable resolves to Gates on the branch: typecheck clean, 452 frontend tests pass, Shout if you would rather I split the |
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 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". |
|
@codex review |
|
The follow-up changes increase scope towards what #7954 did; worth checking if anything from the other PR is worth including here. |
|
Codex Review: Didn't find any major issues. Swish! 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". |
unslothai#7957 merged first and carried its own compensation for the same overlap. DesktopChromeVarsEffect mirrored the titlebar height onto <html> so the response details and document preview sheets could offset themselves with marginTop, since the wrapper div's CSS vars do not reach a Radix portal. With SheetViewportInsetProvider both mechanisms apply, pushing those two panels to 68px and leaving them 34px past the viewport bottom. Remove the per-sheet compensation and the mirror it needed, so the context is the only offset, and extend the contract test to pin that.
…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.
…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.
* Studio: Keep sheets below the custom titlebar * Studio: drop the per-sheet titlebar offset now that #7957 has landed #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: #8016 gave it a second job, mirroring --studio-window-chrome-top for the dialogs that portal to body. * Tidy comment wording for PR #7954 * Inset sheets with the mirrored titlebar variable, not a React context * Tighten the sheet inset comments for PR #7954 --------- Co-authored-by: Daniel Han <[email protected]>
Summary
The close buttons in Response details and Document preview are not vertically aligned with their titles. The shared default uses a fixed 16px top offset for a 32px button, while the title lines follow Studio's adjustable UI font size.
This PR keeps both close buttons centered on their titles across the full 12px to 20px UI font-size range.
What changed
SheetCloseButtonthat preserves the existing icon, size, style, and accessible label.The header height, title position, button size, and horizontal position are unchanged.
Screenshots
Before
After
Testing
npm run typechecknpm run buildnpm exec eslint src/components/ui/sheet.tsx src/components/assistant-ui/message-response-details-sheet.tsxpython -m pytest tests/studio/test_chat_response_details_ui_contract.py -q(7 passed)git diff --checkRuntime validation
Built and served Studio from this branch, then measured both rendered header structures with Playwright against the compiled application stylesheet.
At the default 15px UI font size, the old fixed offset put the Response details close button 4.750px below its title center and the Document preview close button 6.625px below its title center. Both differences are 0.000px after the change.
The centers also match exactly at the 12px, 16px, and 20px UI font sizes. The Response details sheet was additionally exercised in a live chat.