The best way to control Claude Code, Codex and more from any computer or phone
fix(web): model picker no longer jumps when switching providers (#25358)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Theo Browne committed
Oct 25, 2026 at 23:53 UTC
5a38e6b859e8c08fa29371d9c1d6670b3f0e6f54
1 file changed
+43
-9
apps/web/src/components/chat/ModelPickerContent.tsx
+43
-9
@@ -163,6 +163,11 @@ function adjacentModelPickerProvider(input: {
163
164
const EMPTY_MODEL_JUMP_LABELS = new Map<string, string>();
165
const MODEL_LIST_ESTIMATED_ITEM_SIZE = 52;
166
+// Rendered heights in `--spacing` units. Chrome is the search box and list padding, plus a 1px border.
167
+const ONE_LINE_ROW_UNITS = 8;
168
+const TWO_LINE_ROW_UNITS = { classic: 11.25, redesign: 12 };
169
+const ROW_SEPARATOR_UNITS = 0.5;
170
+const LIST_CHROME_UNITS = 15.5;
171
172
function ModelListSeparator() {
173
return <div className="h-0.5" />;
@@ -259,10 +264,6 @@ function ModelPickerList({
264
}) {
265
const [showTopScrollFade, setShowTopScrollFade] = useState(false);
266
const [showBottomScrollFade, setShowBottomScrollFade] = useState(false);
262
- const [contentSize, setContentSize] = useState(
263
- () => itemKeys.length * MODEL_LIST_ESTIMATED_ITEM_SIZE,
264
- );
265
- useLayoutEffect(() => listRef.current?.getState().listen("totalSize", setContentSize), [listRef]);
267
const updateScrollFades = () => {
268
const scrollElement = listRef.current?.getScrollableNode();
269
if (!(scrollElement instanceof HTMLElement)) {
@@ -297,10 +298,10 @@ function ModelPickerList({
298
299
return (
300
<div
300
- className="relative min-h-0 overflow-hidden pr-px"
301
- style={{
302
- height: itemKeys.length === 0 ? 0 : `calc(${contentSize}px + var(--spacing) * 5)`,
303
- }}
301
+ className={cn(
302
+ "relative min-h-0 overflow-hidden pr-px",
303
+ itemKeys.length > 0 ? "flex-1" : "h-0",
304
+ )}
305
>
306
<ComboboxListVirtualized>
307
<LegendList<string>
@@ -578,6 +579,33 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
579
// Inside one provider's tab the provider line repeats the selected rail icon on every row.
580
const redesign = useClientSettings((s) => s.redesignEnabled);
581
const rowsMixProviders = !redesign || isSearching || selectedInstanceId === "favorites";
582
+ // Fit the tallest tab so switching tabs never resizes the popup and moves the rail under the cursor.
583
+ const tallestTabUnits = (() => {
584
+ const unitsByTab = new Map<ProviderInstanceId | "favorites", number>();
585
+ const addRow = (tab: ProviderInstanceId | "favorites", twoLine: boolean) => {
586
+ const rowUnits = twoLine
587
+ ? TWO_LINE_ROW_UNITS[redesign ? "redesign" : "classic"]
588
+ : ONE_LINE_ROW_UNITS;
589
+ const previous = unitsByTab.get(tab);
590
+ unitsByTab.set(
591
+ tab,
592
+ previous === undefined ? rowUnits : previous + ROW_SEPARATOR_UNITS + rowUnits,
593
+ );
594
+ };
595
+ const tabsWithLegacyRow = new Set<ProviderInstanceId>();
596
+ for (const model of flatModels) {
597
+ if (!matchesLockedProvider(model)) continue;
598
+ const isFavorite = favoritesSet.has(providerModelKey(model.instanceId, model.slug));
599
+ if (isFavorite) addRow("favorites", true);
600
+ if (model.isLegacy && !isFavorite) {
601
+ tabsWithLegacyRow.add(model.instanceId);
602
+ } else {
603
+ addRow(model.instanceId, !redesign || Boolean(model.subProvider));
604
+ }
605
+ }
606
+ for (const instanceId of tabsWithLegacyRow) addRow(instanceId, true);
607
+ return Math.max(0, ...unitsByTab.values());
608
+ })();
609
const lockedDisabledInstanceIds = (() => {
610
if (!isLocked) {
611
return undefined;
@@ -799,7 +827,13 @@ export const ModelPickerContent = memo(function ModelPickerContent(props: {
827
<div
828
ref={pickerContentRef}
829
className="relative flex max-h-86.5 w-screen max-w-90 flex-row overflow-hidden"
802
- style={isSearching ? { height: searchHeight } : undefined}
830
+ style={
831
+ isSearching
832
+ ? { height: searchHeight }
833
+ : {
834
+ minHeight: `min(calc(var(--spacing) * ${tallestTabUnits + LIST_CHROME_UNITS} + 1px), calc(var(--spacing) * 86.5))`,
835
+ }
836
+ }
837
data-model-picker-content="true"
838
>
839
{showSidebar && (