fix(studio): stop the chrome bars overlapping on phone viewports - #678
Merged
Conversation
On a phone the Header's left group was allowed to shrink below its content width, so its `shrink-0` children (project title, "live" badge) spilled out over the right-hand cluster — the privacy button, revision history and Share painted on top of each other — and the Toolbar pushed Run past the right edge of a scroll region with no visible scrollbar. - Header: clip the left group (`overflow-hidden`) so nothing can paint over the instrument cluster, and below `lg` collapse the view-mode, background, grid, undo/redo, history and export controls into one labelled overflow menu. Measured: the full inline set only fits from ~1024px up. - Toolbar: below `md` keep Validate and Run on the bar and move Agent, Connect, My Designs, Publish & Share, Brush, Section, Reference, Env and Inspector into the same style of overflow menu. - New `OverflowMenu` renders its panel through a portal, since the bars are `overflow-x:auto` containers that would otherwise clip it to the bar height (the same reason `UserMenu` already portals). - /p/:slug header chrome: icon-only privacy toggle and a dot-only live badge below `md`, and a title that truncates to nothing rather than pushing the badge under the clip. Verified in Chromium at 360/412/768/900/1024/1440px: zero intersecting control rectangles and no horizontal overflow in either bar at every width. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013tihNjUS55tgWpb6Cv7trZ
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.
The bug
On a phone, the Studio chrome bars pile controls on top of each other: the privacy button, revision-history icon, the
● livebadge and Share all paint over one another in the Header, andRunsits half off the right edge of the Toolbar.Root cause: the Header's left group had
min-w-0with no clip, so it was squeezed below its content width and itsshrink-0children (project title, live badge) spilled out of their box and over the right-hand cluster..bar-scroll-xwas meant to catch this by scrolling, but an overflowing child never engages it — and its scrollbar is hidden, so the Toolbar'sRunjust looked cut off.The fix
overflow-hidden) so nothing can paint over the right cluster, and belowlgcollapse the instruments (display mode, background, ground grid, undo/redo, revision history, STEP/STL export) into one labelled overflow menu.lgrather thanmdbecause the full inline set measurably only fits from ~1024px up, so tablets were affected too.md, Validate and Run stay on the bar; Agent, Connect, My Designs, Publish & Share, Brush, Section, Reference, Env and Inspector move into a matching overflow menu.OverflowMenu— renders its panel through a portal, since both bars areoverflow-x:autocontainers that would otherwise clip a dropdown to the 32–40px bar height (the same reasonUserMenualready portals). Closes on outside click, Escape, or a second press of the trigger.useIsNarrow—useSyncExternalStoreovermatchMedia, so there's no set-state-in-effect and no first-paint flash of the desktop layout. Falls back to desktop whenmatchMediais absent (SSR / happy-dom)./p/:slugheader chrome — icon-only privacy toggle and a dot-only live badge belowmd; the title truncates to nothing (and drops out under 400px) rather than pushing the badge under the clip.px-4/px-3topx-2on phones.Verification
A probe intersecting every visible control rect in both bars, run in Chromium against
/p/:slugwith stubbed project data, at 360 / 412 / 768 / 900 / 1024 / 1440px:scrollWidth === clientWidthin both bars at every width (nothing pushed off-screen)Before the fix the same probe reported the live badge overlapping the history control by 20px and Share by 28px at 412px, and 6 overlapping pairs at 768px.
Also: 8 new unit tests covering the collapse behaviour in both bars (
Header.mobile.test.tsx,Toolbar.mobile.test.tsx), plus the fullsrc/studiosuite (632 tests),npm run lintandnpm run typecheckall passing.Note
On the phone header the project title is the element that gives way — it truncates and disappears entirely under 400px. The alternative was dropping the live badge instead; that's a one-line flip if preferred.
🤖 Generated with Claude Code
https://claude.ai/code/session_013tihNjUS55tgWpb6Cv7trZ
Generated by Claude Code