@devries-cameron20 / t3code Mirror · read-only / commits / bbe826993f
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 23, 04:15 UTC

fix(web): pending questions no longer squash the composer on narrow windows (#20391)

Matthew Feroz committed Oct 18, 2026 at 15:14 UTC bbe826993fb85e010ad2e3df129f4a853ae8eac1
1 file changed +22 -94
apps/web/src/components/chat/ChatComposer.tsx
+22 -94
@@ -2428,8 +2428,14 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2428 key: 0,
2429 active: false,
2430 });
2431 + // A pending question stays expanded: its card moves into the banner dock,
2432 + // so collapsing would leave the surface empty and squashed beneath it.
2433 const isComposerCollapsedMobile =
2432 - isMobileViewport && !forceExpandedOnMobile && !isComposerFocused && !hasMultilinePrompt;
2434 + isMobileViewport &&
2435 + !forceExpandedOnMobile &&
2436 + !isComposerFocused &&
2437 + !hasMultilinePrompt &&
2438 + pendingUserInputs.length === 0;
2439
2440 const composerEditorRef = useRef<ComposerPromptEditorHandle>(null);
2441 const pasteAsTextShortcutUntilRef = useRef(0);
@@ -2787,8 +2793,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2793 isComposerApprovalState ||
2794 pendingUserInputs.length > 0 ||
2795 (!isComposerCollapsedMobile && showPlanFollowUpPrompt && activeProposedPlan !== null);
2790 - const showCollapsedMobilePromptRow =
2791 - isComposerCollapsedMobile && !isComposerApprovalState && pendingUserInputs.length === 0;
2796 + const showCollapsedMobilePromptRow = isComposerCollapsedMobile && !isComposerApprovalState;
2797 const showComposerAttachAction =
2798 fileStagingLimit !== null &&
2799 (!activePendingProgress ||
@@ -5937,6 +5942,15 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
5942 setIsComposerFocused(false);
5943 });
5944 };
5945 + const scheduleComposerCollapseCheckStable = useStableCallback(scheduleComposerCollapseCheck);
5946 +
5947 + // Answering or dismissing a question unmounts the control that held focus,
5948 + // and React fires no blur for a removed element.
5949 + const activePendingUserInputRequestId = activePendingUserInput?.requestId ?? null;
5950 + useEffect(() => {
5951 + if (activePendingUserInputRequestId !== null) return;
5952 + scheduleComposerCollapseCheckStable();
5953 + }, [activePendingUserInputRequestId, scheduleComposerCollapseCheckStable]);
5954
5955 useEffect(() => {
5956 return () => {
@@ -6420,7 +6434,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
6434 />
6435 </ComposerBanner.Actions>
6436 </ComposerBanner.Row>
6423 - ) : !isComposerCollapsedMobile && pendingUserInputs.length > 0 ? (
6437 + ) : pendingUserInputs.length > 0 ? (
6438 <ComposerPendingUserInputPanel
6439 pendingUserInputs={pendingUserInputs}
6440 cwd={gitCwd ?? undefined}
@@ -6442,82 +6456,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
6456 key={activeProposedPlan.id}
6457 planTitle={proposedPlanTitle(activeProposedPlan.planMarkdown) ?? null}
6458 />
6445 - ) : isComposerCollapsedMobile && pendingUserInputs.length > 0 ? (
6446 - <div data-chat-composer-collapsed-controls="true">
6447 - <ComposerPendingUserInputPanel
6448 - pendingUserInputs={pendingUserInputs}
6449 - cwd={gitCwd ?? undefined}
6450 - threadRef={routeThreadRef}
6451 - disabled={!canOperateThread}
6452 - respondingRequestIds={
6453 - activePendingIsResponding && activePendingUserInput
6454 - ? [...respondingRequestIds, activePendingUserInput.requestId]
6455 - : respondingRequestIds
6456 - }
6457 - answers={activePendingDraftAnswers}
6458 - questionIndex={activePendingQuestionIndex}
6459 - onToggleOption={onSelectActivePendingUserInputOption}
6460 - onAdvance={onAdvanceActivePendingUserInput}
6461 - onDismiss={onDismissActivePendingUserInput}
6462 - />
6463 - {!isChoiceOnlyPendingQuestion ||
6464 - activePendingProgress?.activeQuestion?.multiSelect ? (
6465 - <ComposerBanner.Body>
6466 - <div
6467 - data-chat-composer-mobile-pending-compact="true"
6468 - className={cn(
6469 - "flex min-w-0 items-center gap-2 rounded-lg border border-border/55 bg-background/55 p-1.5 pl-3 transition-colors hover:bg-background/80",
6470 - !activePendingProgress?.activeQuestion?.multiSelect && "p-0",
6471 - )}
6472 - >
6473 - {!isChoiceOnlyPendingQuestion ? (
6474 - <button
6475 - type="button"
6476 - className={cn(
6477 - "min-w-0 flex-1 truncate bg-transparent py-1.5 text-left text-sm",
6478 - activePendingProgress?.customAnswer
6479 - ? "text-foreground"
6480 - : "text-placeholder",
6481 - !activePendingProgress?.activeQuestion?.multiSelect && "px-3 py-2",
6482 - )}
6483 - onPointerDown={(event) => event.preventDefault()}
6484 - onClick={expandMobileComposerStable}
6485 - aria-label="Write custom answer"
6486 - >
6487 - {activePendingProgress?.customAnswer || "Write custom answer"}
6488 - </button>
6489 - ) : null}
6490 - {activePendingProgress?.activeQuestion?.multiSelect ? (
6491 - <ComposerPrimaryActions
6492 - compact
6493 - canOperateThread={canOperateThread}
6494 - pendingAction={pendingPrimaryAction}
6495 - isRunning={false}
6496 - canInterrupt={false}
6497 - showPlanFollowUpPrompt={false}
6498 - promptHasText={false}
6499 - isSendBusy={isSendBusy}
6500 - sendDisabledReason={sendDisabledReason}
6501 - isConnecting={isConnecting}
6502 - isEnvironmentUnavailable={
6503 - environmentUnavailable !== null ||
6504 - noProviderAvailable ||
6505 - projectSelectionRequired
6506 - }
6507 - isPreparingWorktree={false}
6508 - hasSendableContent={false}
6509 - preserveComposerFocusOnPointerDown
6510 - onPreviousPendingQuestion={onPreviousActivePendingUserInputQuestion}
6511 - onInterrupt={handleInterruptPrimaryActionStable}
6512 - onImplementPlanInNewThread={
6513 - handleImplementPlanInNewThreadPrimaryActionStable
6514 - }
6515 - />
6516 - ) : null}
6517 - </div>
6518 - </ComposerBanner.Body>
6519 - ) : null}
6520 - </div>
6459 ) : null}
6460 </ComposerBanner.Root>
6461 </ComposerBanner.Attachment>
@@ -6582,24 +6520,14 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
6520 data-chat-composer-transition-prompt="true"
6521 className={cn(
6522 "min-w-0 flex-1 truncate bg-transparent p-0 text-left text-sm focus:outline-none",
6585 - (activePendingProgress ? activePendingProgress.customAnswer : prompt.trim())
6586 - ? "text-foreground"
6587 - : "text-placeholder",
6523 + prompt.trim() ? "text-foreground" : "text-placeholder",
6524 )}
6525 onPointerDown={(event) => event.preventDefault()}
6590 - onClick={isChoiceOnlyPendingQuestion ? undefined : expandMobileComposerStable}
6591 - disabled={isChoiceOnlyPendingQuestion}
6526 + onClick={expandMobileComposerStable}
6527 aria-label="Expand composer"
6528 >
6594 - {activePendingProgress
6595 - ? isChoiceOnlyPendingQuestion
6596 - ? "Choose an option above"
6597 - : activePendingProgress.customAnswer ||
6598 - "Type your own answer, or leave this blank to use the selected option"
6599 - : prompt.trim() ||
6600 - (showProviderUnavailable
6601 - ? "Enable a provider in Settings"
6602 - : "Ask anything...")}
6529 + {prompt.trim() ||
6530 + (showProviderUnavailable ? "Enable a provider in Settings" : "Ask anything...")}
6531 </button>
6532 {collapsedComposerImagePreviews}
6533 <button