Skip to content

Studio: keep menus and popovers below the desktop titlebar - #12348

Merged
shimmyshimmer merged 6 commits into
mainfrom
fix/popups-clear-desktop-titlebar
Sep 30, 2026
Merged

shimmyshimmer merged 6 commits into
mainfrom
fix/popups-clear-desktop-titlebar

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

In the desktop app, a dropdown that opens upward in a short window can end up with its top rows hidden behind the titlebar. The composer's + menu is the easiest way to see it.

The titlebar paints over body-portaled surfaces. Dialogs, toasts and the settings window already stay clear of it with --studio-window-chrome-top, but Radix sizes and places menus against the window edge. So a menu capped to "the space above the trigger" was allowed to reach y=0, and the part under the titlebar could not be seen or clicked.

The shared floating primitives now add the titlebar height to the top of their collision padding:

  • DropdownMenuContent and DropdownMenuSubContent
  • ContextMenuContent and ContextMenuSubContent
  • MenubarContent and MenubarSubContent
  • PopoverContent, SelectContent, HoverCardContent
  • The combobox positioner (on top of Base UI's default of 5)
  • The message action bar's More menu, which is assistant-ui's own Radix content rather than DropdownMenuContent. It also gets a max height of Radix's available height: padding only moves a menu sideways, so without a cap a menu that flips up with no room on either side keeps its full height and still runs under the titlebar.

PopoverContent also gets that cap, with vertical scrolling, as popovers are often tall (the Agents model picker is a search box plus a 288px list). Callers that set their own max-h or overflow keep them.

DropdownMenuSubContent gets the same cap as DropdownMenuContent, with an inner scrolling viewport, so a long submenu (projects, the composer More list) stays reachable.

ContextMenuSubContent is capped and scrolls the same way as ContextMenuContent. The sidebar's Move to and Section submenus already set this themselves, so they render the same; this covers any other caller.

Radix then caps, flips and shifts against the titlebar's bottom edge instead of the window edge, so every menu built on these gets the fix. A caller's own collisionPadding is kept and added to.

The height comes from a small store in src/lib/window-chrome.ts. It reads --studio-window-chrome-top once, is refreshed by DesktopChromeVarsEffect when the chrome variables change, and follows interface zoom on macOS, where the titlebar inset is divided by the zoom. It is 0 in a browser, so the web UI is unchanged.

Validation

  • Full frontend suite, merged with main: 9,521 tests passed.
  • tsc -b and the test tsconfig pass.
  • New window-chrome-collision.test.ts covers the padding math and checks that each primitive, the message More menu and the refresh paths use it.
  • Browser check at 900x460 with a 34px titlebar simulated, opening the composer + menu:
Menu top Hidden behind the titlebar
main 0px 34px, including "Add photos & files"
this PR 34px none; capped at 277.5px and scrolls

Message More menu at 900x380, trigger at y=205 so the menu flips up:

Menu top Hidden behind the titlebar
before 11px 23px, including the timestamp row
this PR 34px none; capped at 167px and scrolls

Agents model picker at 900x460, trigger at y=313 so the popover opens up:

Popover Result
before 34px to 345px covers its own trigger
this PR 34px to 309px capped at 275px, the list scrolls

Composer + > More submenu at 900x200:

Submenu Result
before 34px to 279.5px last 80px of rows past the window edge
this PR 34px to 200px capped at 166px, the rows scroll

The desktop titlebar paints over body-portaled surfaces, but Radix sizes
and places menus against the window edge. A menu opening upward in a
short window was capped to the full height above its trigger, so its
top rows sat behind the titlebar.

The floating primitives (dropdown, context menu, menubar, popover,
select, hover card, combobox) now add --studio-window-chrome-top to their
top collision padding, so Radix caps, flips and shifts against the
titlebar's bottom edge. The value is read once and refreshed when the
desktop chrome or macOS zoom changes. It is 0 in a browser.

Also lets more-menu-separator-gap.test.ts match the More flyout now that
it carries a ref (#12339).
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 30, 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-30T14:24:21.661953Z 65a0b0f 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: cc70f4c855

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

The message action bar's More menu is assistant-ui's own Radix content,
not DropdownMenuContent, so it missed the titlebar padding. Its height
was also uncapped: when neither side has room, a menu that flips up keeps
its full height and still runs under the titlebar, since padding only
moves it sideways.

Give it the titlebar collision padding and cap it at Radix's available
height, so it stops at the titlebar and scrolls.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

Pushed 2495705 to cover the message action bar's More menu.

That menu is ActionBarMorePrimitive.Content from assistant-ui, so it doesn't go through DropdownMenuContent and missed the titlebar padding. Padding alone also wasn't enough there: the menu had no height cap, and Radix only shifts a menu along its alignment axis, so when it flips up with no room on either side it keeps its full height and runs under the titlebar anyway.

It now uses useWindowChromeCollisionPadding and caps at --radix-dropdown-menu-content-available-height with vertical scrolling, the same as DropdownMenuContent.

Checked at 900x380 with a 34px titlebar simulated and the More trigger at y=205:

Menu top Height
before 11px (under the titlebar) 190px
now 34px 167px, scrolls

With no titlebar the menu is unchanged (top 11px, 190px). The composer + menu still matches the numbers above (34px, capped at 277.5px).

Also checked the rest of the primitives while here: the Windows titlebar is z-[70], so tooltips (z-[999999]) and the combobox (z-[120]) paint above it and don't need a cap, MenubarContent has no callers, and the popovers that can grow tall already cap themselves at Radix's available height, which now accounts for the titlebar. No caller passes its own titlebar offset, so nothing double counts.

window-chrome-collision.test.ts asserts the padding and the cap on the More menu. Typecheck is clean and the full frontend suite passes (9,508).

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

Radix's collision padding moves a popover but doesn't shrink it, so a tall
one (like the Agents model picker) could cover its trigger or run under the
desktop titlebar. Cap PopoverContent at the available height and scroll.
Callers that set their own max-h or overflow keep them.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

DropdownMenuSubContent had no max height, so a long submenu (projects, the
composer More list) could run past the window or under the titlebar with its
rows out of reach. Cap it and scroll an inner viewport, like the top-level
menu.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

chatgpt-codex-connector[bot]

This comment was marked as resolved.

ContextMenuSubContent had no max height of its own. The sidebar's Move to
and Section submenus already pass one, so cap and scroll the primitive like
ContextMenuContent for any other caller. Those two render the same.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 13ab11f6a5

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

…top-titlebar

# Conflicts:
#	studio/frontend/tests/more-menu-separator-gap.test.ts
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 65a0b0fab1

ℹ️ 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 f0af859 into main Sep 30, 2026
38 of 39 checks passed
@shimmyshimmer
shimmyshimmer deleted the fix/popups-clear-desktop-titlebar branch September 30, 2026 14:39
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.

1 participant