Skip to content

🤖 fix: clamp model selector dropdown height to stay below the top bar - #3953

Merged
ibetitsmike merged 1 commit into
mainfrom
mike/dropdown-xegy
Aug 25, 2026
Merged

🤖 fix: clamp model selector dropdown height to stay below the top bar#3953
ibetitsmike merged 1 commit into
mainfrom
mike/dropdown-xegy

Conversation

@ibetitsmike

Copy link
Copy Markdown
Contributor

Summary

The model selector dropdown could render partially or fully under the top bar, hiding its search input and top items. The panel now measures the space above its trigger when it opens and clamps its height so it always fits below the bar, with only the model list shrinking and scrolling.

Background

The dropdown opens upward (absolute bottom-full) with a fixed 280px list plus a search header and footer, and nothing constrained it to the viewport. In short windows, or wherever the composer sits high (for example the new-workspace page), the panel top extended past the window top and under the title/menu bar. The auto-focused search input became invisible, and in desktop mode the bar is a window-drag region, so the overlapped part could not even receive clicks.

Implementation

  • ModelSelector runs a layout effect when the dropdown opens: it reads the trigger's viewport position and caps the panel max-height to the space above it, keeping clear of the titlebar height plus a small gap. It re-measures on window resize.
  • The panel is now a flex column; the search header and footer are shrink-0, so only the model list shrinks and scrolls. The existing 280px list cap still applies when space allows.
  • A 150px floor keeps the panel usable in pathological layouts (slight bar overlap is preferred over an unusably short panel).
  • useDesktopTitlebar.ts exports the titlebar height as a numeric constant alongside the existing Tailwind classes.

The sibling pickers (AgentModePicker, ThinkingSelector) share the upward-opening pattern but are short enough not to hit this in practice; they are left unchanged to keep the diff minimal.

Validation

Reproduced and verified visually in Storybook (ModelSelectorDropdownOpen story) at a 900x400 viewport, where the old code placed the panel top ~38px above the window: the full panel (search input, scrollable list, footer) now fits between the top bar and the trigger.

No unit test added: happy-dom cannot do layout, so the only possible assertion would restate the clamp arithmetic against a mocked rect.


Generated with xum • Model: anthropic:claude-fable-5 • Thinking: xhigh

The panel opens upward with a fixed-height list, so in short windows it
extended past the top of the viewport and under the title/menu bar,
hiding the auto-focused search input (and making it unclickable, since
the bar is a window-drag region in desktop mode). Measure the trigger
position when the dropdown opens and cap the panel max-height so it fits
above the trigger; only the model list shrinks and scrolls.
@ibetitsmike

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Can't wait for the next one!

Reviewed commit: 0a94f974c3

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

@chatgpt-codex-connector

This comment has been minimized.

@ibetitsmike
ibetitsmike added this pull request to the merge queue Aug 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@ibetitsmike
ibetitsmike added this pull request to the merge queue Aug 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 25, 2026
@ibetitsmike
ibetitsmike added this pull request to the merge queue Aug 25, 2026
Merged via the queue into main with commit 5b18f3e Aug 25, 2026
35 of 38 checks passed
@ibetitsmike
ibetitsmike deleted the mike/dropdown-xegy branch August 25, 2026 09:46
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