Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(web): keep send reachable while a turn is running on mobile (#4781)

BootesVoid7afa184a99b2
diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx
index 5072c5870..afba1e086 100644
--- a/apps/web/src/components/chat/ChatComposer.tsx
+++ b/apps/web/src/components/chat/ChatComposer.tsx
@@ -407,6 +407,7 @@ const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(
isEnvironmentUnavailable: boolean;
hasSendableContent: boolean;
preserveComposerFocusOnPointerDown?: boolean;
+ showSendWhileRunning?: boolean;
onPreviousPendingQuestion: () => void;
onInterrupt: () => void;
onImplementPlanInNewThread: () => void;
@@ -435,6 +436,7 @@ const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(
isPreparingWorktree={props.isPreparingWorktree}
hasSendableContent={props.hasSendableContent}
preserveComposerFocusOnPointerDown={props.preserveComposerFocusOnPointerDown ?? false}
+ showSendWhileRunning={props.showSendWhileRunning ?? false}
onPreviousPendingQuestion={props.onPreviousPendingQuestion}
onInterrupt={props.onInterrupt}
onImplementPlanInNewThread={props.onImplementPlanInNewThread}
@@ -3166,6 +3168,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
isPreparingWorktree={isPreparingWorktree}
hasSendableContent={composerSendState.hasSendableContent}
preserveComposerFocusOnPointerDown={isMobileViewport}
+ showSendWhileRunning={isMobileViewport}
onPreviousPendingQuestion={onPreviousActivePendingUserInputQuestion}
onInterrupt={handleInterruptPrimaryAction}
onImplementPlanInNewThread={handleImplementPlanInNewThreadPrimaryAction}
diff --git a/apps/web/src/components/chat/ComposerPrimaryActions.test.ts b/apps/web/src/components/chat/ComposerPrimaryActions.test.tsx
similarity index 80%
rename from apps/web/src/components/chat/ComposerPrimaryActions.test.ts
rename to apps/web/src/components/chat/ComposerPrimaryActions.test.tsx
index 3dbcd39e9..c48f029f7 100644
--- a/apps/web/src/components/chat/ComposerPrimaryActions.test.ts
+++ b/apps/web/src/components/chat/ComposerPrimaryActions.test.tsx
@@ -65,6 +65,28 @@ function renderStandaloneStop() {
);
}
+function renderRunningActions(showSendWhileRunning: boolean, hasSendableContent: boolean) {
+ return renderToStaticMarkup(
+ createElement(ComposerPrimaryActions, {
+ compact: true,
+ pendingAction: null,
+ isRunning: true,
+ showPlanFollowUpPrompt: false,
+ promptHasText: hasSendableContent,
+ isSendBusy: false,
+ sendDisabledReason: null,
+ isConnecting: false,
+ isEnvironmentUnavailable: false,
+ isPreparingWorktree: false,
+ hasSendableContent,
+ showSendWhileRunning,
+ onPreviousPendingQuestion: () => {},
+ onInterrupt: () => {},
+ onImplementPlanInNewThread: () => {},
+ }),
+ );
+}
+
function renderSendButton() {
return renderToStaticMarkup(
createElement(ComposerPrimaryActions, {
@@ -215,4 +237,27 @@ describe("ComposerPrimaryActions", () => {
expect(markup).not.toContain("stage-nightly");
expect(markup).toContain("bg-message-action text-message-action-foreground");
});
+
+ it("only renders stop while running when Enter-to-send is available", () => {
+ const markup = renderRunningActions(false, true);
+
+ expect(markup).toContain('aria-label="Stop generation"');
+ expect(markup).not.toContain('aria-label="Send message"');
+ });
+
+ it("renders send alongside stop while running when Enter-to-send is unavailable", () => {
+ const markup = renderRunningActions(true, true);
+
+ expect(markup).toContain('aria-label="Stop generation"');
+ expect(markup).toContain('aria-label="Send message"');
+ expect(markup).toContain('type="submit"');
+ expect(markup).toContain("size-9 sm:size-8");
+ });
+
+ it("keeps stop as the only action while running with an empty composer", () => {
+ const markup = renderRunningActions(true, false);
+
+ expect(markup).toContain('aria-label="Stop generation"');
+ expect(markup).not.toContain('aria-label="Send message"');
+ });
});
diff --git a/apps/web/src/components/chat/ComposerPrimaryActions.tsx b/apps/web/src/components/chat/ComposerPrimaryActions.tsx
index d8626496a..2a27796d9 100644
--- a/apps/web/src/components/chat/ComposerPrimaryActions.tsx
+++ b/apps/web/src/components/chat/ComposerPrimaryActions.tsx
@@ -28,6 +28,9 @@ interface ComposerPrimaryActionsProps {
isPreparingWorktree: boolean;
hasSendableContent: boolean;
preserveComposerFocusOnPointerDown?: boolean;
+ /** Enter-to-send is disabled on mobile viewports, where stop would otherwise
+ * be the only primary action and a running turn could not be steered. */
+ showSendWhileRunning?: boolean;
onPreviousPendingQuestion: () => void;
onInterrupt: () => void;
onImplementPlanInNewThread: () => void;
@@ -68,6 +71,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
isPreparingWorktree,
hasSendableContent,
preserveComposerFocusOnPointerDown = false,
+ showSendWhileRunning = false,
onPreviousPendingQuestion,
onInterrupt,
onImplementPlanInNewThread,
@@ -86,7 +90,11 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
type="button"
className={cn(
"flex cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-all duration-150 hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none",
- insidePendingAction ? "size-8 sm:size-7" : "size-8 sm:h-8 sm:w-8",
+ insidePendingAction
+ ? "size-8 sm:size-7"
+ : showSendWhileRunning && hasSendableContent
+ ? "size-9 sm:size-8"
+ : "size-8 sm:h-8 sm:w-8",
)}
{...pointerFocusProps}
onClick={onInterrupt}
@@ -153,10 +161,6 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
);
}
- if (isRunning) {
- return renderStopGenerationButton(false);
- }
-
if (showPlanFollowUpPrompt) {
if (promptHasText) {
return (
@@ -214,7 +218,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
);
}
- return (
+ const sendButton = (
<button
type="submit"
className={cn(
@@ -265,4 +269,15 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
)}
</button>
);
+
+ if (!isRunning) {
+ return sendButton;
+ }
+
+ return (
+ <>
+ {renderStopGenerationButton(false)}
+ {showSendWhileRunning && hasSendableContent ? sendButton : null}
+ </>
+ );
});