fix: keep model selector dropdown within viewport#1496
Open
Horizonll wants to merge 1 commit into
Open
Conversation
Clamp the portal dropdown width and horizontal position to the viewport so the model list remains visible in narrow windows. Verification: - pnpm --dir src/web-ui run test:run src/flow_chat/components/modelSelectorDropdownPosition.test.ts - pnpm run type-check:web - pnpm run build:web
There was a problem hiding this comment.
Pull request overview
This PR fixes the Web UI model selector dropdown positioning in narrow windows by extracting a dedicated positioning helper that clamps the dropdown’s horizontal placement and width to the viewport, ensuring the menu stays fully visible near the right edge.
Changes:
- Added
getModelSelectorDropdownStylehelper to compute a fixed-position dropdown style with viewport clamping. - Updated
ModelSelectorto use the new helper for portal dropdown positioning on open/scroll/resize. - Adjusted dropdown SCSS to support shrinking layouts (including truncation/ellipsis behavior in the header and options).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/web-ui/src/flow_chat/components/modelSelectorDropdownPosition.ts | New helper for dropdown width/left clamping and top/bottom placement style computation. |
| src/web-ui/src/flow_chat/components/modelSelectorDropdownPosition.test.ts | Unit tests validating clamping behavior in narrow viewports and max-width scenarios. |
| src/web-ui/src/flow_chat/components/ModelSelector.tsx | Switches runtime dropdown positioning logic to the new helper. |
| src/web-ui/src/flow_chat/components/ModelSelector.scss | Updates dropdown sizing rules and improves truncation behavior for narrow widths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Fix the model selector dropdown positioning so the model list stays fully visible when the app window is narrowed.
Fixes #1494
Type and Areas
Type:
bug fix / UI/UX
Areas:
web UI
Motivation / Impact
When the window width is reduced and the model selector is opened near the right edge, the dropdown was positioned from the trigger's left edge without clamping to the viewport. This could push the model list outside the visible window.
This change extracts the dropdown positioning calculation into a focused helper, clamps the dropdown width and horizontal position to the viewport, and lets narrow layouts shrink the menu while preserving text truncation.
Users can now open the model selector in narrow desktop windows without the list being cut off.
Verification
pnpm --dir src/web-ui run test:run src/flow_chat/components/modelSelectorDropdownPosition.test.tspnpm run type-check:webpnpm run build:webReviewer Notes
Checklist