Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ae39c56
feat(web): style dictation with the redesign primitives
maria-rcks Nov 6, 2026
1d739ef
fix(web): format main's voice settings and keep the recording time on…
maria-rcks Nov 12, 2026
1c93ee5
fix(web): dictation can be cancelled by touch again (#33897)
shivamhwp Nov 12, 2026
399d7b7
Merge main into redesign layer 5
maria-rcks Nov 19, 2026
740a029
fix(web): compile layer 5 against main's issues and clipboard APIs
maria-rcks Nov 19, 2026
25e7466
fix(web): wrap layer 5 copy that the derive left unwrapped
maria-rcks Nov 19, 2026
8c35497
Merge main into redesign layer 5
maria-rcks Nov 19, 2026
2c7ab33
fix(web): fit main's linked-issue views to layer 5's primitives
maria-rcks Nov 19, 2026
16ccc7b
fix(web): linked issue rows use the page row hover and press classes
maria-rcks Nov 19, 2026
9377b68
fix(web): linked issue rows use the page row classes
maria-rcks Nov 19, 2026
9a13e9e
style: match the repo formatter
maria-rcks Nov 19, 2026
db029bf
test(web): main's issue badge and preview-browser tests follow layer …
maria-rcks Nov 19, 2026
ee76adf
test(web): find the preview-browser menu item in its portal
maria-rcks Nov 19, 2026
7efb845
fix(web): subagent group row keeps main's translated label and resolvers
maria-rcks Nov 19, 2026
032bd44
fix(web): main's new issue views share layer 6's lines
maria-rcks Nov 19, 2026
bde9d0f
fix(web): terminal close prompts use main's translated label
maria-rcks Nov 19, 2026
07c8bb0
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
9ea322b
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
fdc7a3c
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
67a435d
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
23634a7
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
2a28d0c
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
082de31
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
f8ac2c8
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
6a435be
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
bac6a24
Merge redesign layer 4 into layer 5
maria-rcks Nov 19, 2026
ff05aa4
Merge redesign layer 4 into layer 5
maria-rcks Nov 21, 2026
1576067
Merge redesign layer 4 into layer 5
maria-rcks Nov 21, 2026
3baa869
Merge redesign layer 4 into layer 5
maria-rcks Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 117 additions & 69 deletions apps/web/src/components/chat/ChatComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,13 @@ import {
import { attachmentUploadBlockReason } from "../../lib/attachmentUploadState";
import { useDictationShortcut } from "../../speech/useDictationShortcut";
import { useDictationSubmissionShortcut } from "../../speech/useDictationSubmissionShortcut";
import { useEnvironmentSpeechInput } from "../../speech/useEnvironmentSpeechInput";
import { ComposerSpeechButton, ComposerSpeechRecordingPill } from "./ComposerSpeechButton";
import {
useEnvironmentSpeechInput,
useSpeechUnavailableReason,
} from "../../speech/useEnvironmentSpeechInput";
import { ComposerSpeechButton, ComposerSpeechCancelButton } from "./ComposerSpeechButton";
import { VoiceInputErrorPill } from "./VoiceInputErrorPill";
import { COMPOSER_PILL_SLOT_BUTTON_CLASS_NAME } from "./ComposerPrimaryActions";
import type { AssistantCitationSourceAnchor } from "~/lib/assistantTextSelection";
import { shortcutLabelForCommand, type ShortcutMatchContext } from "../../keybindings";
import {
Expand Down Expand Up @@ -1084,7 +1089,6 @@ export function ChatComposer(props: ChatComposerProps) {
null,
);
const [isDragOverComposer, setIsDragOverComposer] = useState(false);
const [isComposerFooterCompact, setIsComposerFooterCompact] = useState(false);
const [isComposerPrimaryActionsCompact, setIsComposerPrimaryActionsCompact] = useState(false);
const [isComposerModelPickerOpen, setIsComposerModelPickerOpen] = useState(false);
const isMobileViewport = useMediaQuery("max-sm");
Expand Down Expand Up @@ -1650,7 +1654,6 @@ export function ChatComposer(props: ChatComposerProps) {
const measureCompactLayouts = () => {
const composerFormWidth = composerForm.clientWidth;
const options = { hasWideActions: false };
setIsComposerFooterCompact(shouldUseCompactComposerFooter(composerFormWidth));
setIsComposerPrimaryActionsCompact(
shouldUseCompactComposerFooter(composerFormWidth, options) &&
shouldUseCompactComposerPrimaryActions(composerFormWidth, options),
Expand Down Expand Up @@ -2010,8 +2013,6 @@ export function ChatComposer(props: ChatComposerProps) {
},
});
const { blocksSubmission: voiceInputActive, submitAfterDictation } = speechInput;
// A compact footer gives the dictation capsule the whole row beside the send button.
const dictationTakesFooter = isComposerFooterCompact && speechInput.state.phase !== "idle";
const submissionTarget = activePendingProgress ? "pending-user-input" : "provider-turn";
const submissionBlocked = isComposerSubmissionBlocked({
submissionTarget,
Expand Down Expand Up @@ -2039,6 +2040,13 @@ export function ChatComposer(props: ChatComposerProps) {
modelPickerOpen: isComposerModelPickerOpen,
...(backgroundThread ? { targetRef: composerFormRef } : {}),
});
// The editor freezes while dictation runs and drops focus; collapsing then would hide the recording pill.
const dictationActiveRef = useRef(false);
// oxlint-disable-next-line t3code/no-unreasoned-state-sync -- publishes dictation activity to the asynchronous blur check
useEffect(() => {
dictationActiveRef.current = speechInput.state.phase !== "idle";
});
const speechUnavailableReason = useSpeechUnavailableReason(speechInput);

const resolveActiveComposerTrigger = (): {
snapshot: { value: string; cursor: number; expandedCursor: number };
Expand Down Expand Up @@ -2535,6 +2543,29 @@ export function ChatComposer(props: ChatComposerProps) {
});
};
const expandMobileComposerStable = useStableCallback(expandMobileComposer);
const showsSpeechAction = speechInput.available || speechUnavailableReason !== null;
const renderSpeechAction = (inPill: boolean) =>
showsSpeechAction ? (
<ComposerSpeechButton
inPill={inPill}
state={speechInput.state}
shortcutLabel={dictationShortcutLabel}
disabled={dictationDisabled}
unavailableReason={speechUnavailableReason}
onStart={() => {
if (isComposerCollapsedMobile) expandMobileComposerStable();
void speechInput.start();
}}
dictation={{
level: speechInput.level,
onStop: () => void speechInput.stop(),
onSkipPostProcessing: () => speechInput.skipPostProcessing(),
}}
/>
) : null;
// While recording, the send slot becomes Stop and finishes the recording.
const stopDictationStable = useStableCallback(() => void speechInput.stop());
const onStopDictation = speechInput.state.phase === "recording" ? stopDictationStable : undefined;

// Escape dismisses the suggestion so Tab moves focus again.
const { suggestion: promptSuggestion, dismiss: dismissPromptSuggestion } = usePromptSuggestion(
Expand Down Expand Up @@ -3228,7 +3259,7 @@ export function ChatComposer(props: ChatComposerProps) {
}
composerBlurFrameRef.current = window.requestAnimationFrame(() => {
composerBlurFrameRef.current = null;
if (mobileComposerExpandInFlightRef.current) {
if (mobileComposerExpandInFlightRef.current || dictationActiveRef.current) {
return;
}
const composerSurface = composerSurfaceRef.current;
Expand Down Expand Up @@ -3831,44 +3862,63 @@ export function ChatComposer(props: ChatComposerProps) {
isEditingQueuedMessage={isEditingQueuedMessage}
onInterrupt={handleInterruptPrimaryActionStable}
>
<button
type="button"
data-chat-composer-transition-actions="true"
className="flex size-8 shrink-0 items-center justify-center rounded-control surface-pill text-foreground hover:surface-raised-hover disabled:opacity-64"
disabled={collapsedComposerPrimaryActionDisabled}
aria-label={collapsedComposerPrimaryActionLabel}
aria-busy={composerSendHeld || isSendBusy || undefined}
onPointerDown={(event) => event.preventDefault()}
onClick={(event) => {
event.stopPropagation();
if (showResumeAction) onResume();
else if (props.resumeCompactionTokens !== null && !props.keepFullHistory)
expandMobileComposer();
else submitComposer();
}}
>
{composerSendHeld || isSendBusy ? (
<Spinner size="sm" aria-hidden="true" />
) : showResumeAction ? (
<PlayIcon className="size-4 fill-current" aria-hidden="true" />
) : (
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
<div data-chat-composer-transition-actions="true" className="flex shrink-0">
<span
data-composer-send-pill="true"
className="relative isolate inline-flex h-8 shrink-0 items-center rounded-lg surface-pill"
>
{renderSpeechAction(true)}
<button
type="button"
className={COMPOSER_PILL_SLOT_BUTTON_CLASS_NAME}
disabled={onStopDictation ? false : collapsedComposerPrimaryActionDisabled}
aria-label={
onStopDictation
? gt("Stop voice input")
: collapsedComposerPrimaryActionLabel
}
aria-busy={
(!onStopDictation && (composerSendHeld || isSendBusy)) || undefined
}
onPointerDown={(event) => event.preventDefault()}
onClick={(event) => {
event.stopPropagation();
if (onStopDictation) onStopDictation();
else if (showResumeAction) onResume();
else if (props.resumeCompactionTokens !== null && !props.keepFullHistory)
expandMobileComposer();
else submitComposer();
}}
>
<path
d="M8 3L8 13M8 3L4 7M8 3L12 7"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)}
</button>
{onStopDictation ? (
<span
className="size-2.5 rounded-xs bg-error-foreground"
aria-hidden="true"
/>
) : composerSendHeld || isSendBusy ? (
<Spinner size="sm" aria-hidden="true" />
) : showResumeAction ? (
<PlayIcon className="size-4 fill-current" aria-hidden="true" />
) : (
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
>
<path
d="M8 3L8 13M8 3L4 7M8 3L12 7"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)}
</button>
</span>
</div>
</CollapsedComposerStopAction>
</div>
) : null}
Expand Down Expand Up @@ -4068,8 +4118,9 @@ export function ChatComposer(props: ChatComposerProps) {
data-chat-composer-transition-actions="true"
className="z-1 flex w-max max-w-full items-center justify-end gap-1.5 self-start justify-self-end [grid-area:prompt]"
>
{dictationTakesFooter ? null : composerAttachButton}
{composerAttachButton}
<ComposerFooterPrimaryActions
renderSpeechAction={renderSpeechAction}
compact={isComposerPrimaryActionsCompact}
canOperateThread={canOperateThread}
pendingAction={requestCard && requestCardHost ? null : pendingPrimaryAction}
Expand Down Expand Up @@ -4107,33 +4158,30 @@ export function ChatComposer(props: ChatComposerProps) {
onResume={onResume}
onPreviousPendingQuestion={onPreviousActivePendingUserInputQuestion}
onInterrupt={handleInterruptPrimaryActionStable}
onStopDictation={onStopDictation}
stopDictationShortcutLabel={dictationShortcutLabel}
compactBeforeSendTokens={props.resumeCompactionTokens}
hideCompactToggle={dictationTakesFooter}
keepFullHistory={props.keepFullHistory}
onToggleKeepFullHistory={props.onToggleKeepFullHistory}
>
{speechInput.available ? (
<>
<ComposerSpeechRecordingPill
state={speechInput.state}
progress={null}
finishShortcutLabel={dictationShortcutLabel}
cancelShortcutLabel="Esc"
level={speechInput.level}
recordingStartedAt={speechInput.recordingStartedAt}
disabled={dictationDisabled}
onStart={() => void speechInput.start()}
onStop={() => void speechInput.stop()}
onCancel={() => speechInput.cancel()}
onSkipPostProcessing={() => speechInput.skipPostProcessing()}
/>
<ComposerSpeechButton
state={speechInput.state}
shortcutLabel={dictationShortcutLabel}
disabled={dictationDisabled}
onStart={() => void speechInput.start()}
/>
</>
{speechInput.available && speechInput.state.phase === "error" ? (
Comment thread
macroscopeapp[bot] marked this conversation as resolved.
Resolved
<VoiceInputErrorPill
error={speechInput.state.error}
errorAction={speechInput.state.errorAction}
disabled={dictationDisabled}
cancelShortcutLabel="Esc"
onRetry={() => void speechInput.start()}
onDismiss={() => speechInput.cancel()}
/>
) : null}
{speechInput.available &&
speechInput.state.phase !== "idle" &&
speechInput.state.phase !== "error" ? (
<ComposerSpeechCancelButton
state={speechInput.state}
shortcutLabel="Esc"
onCancel={() => speechInput.cancel()}
/>
) : null}
<VoiceInputSetup
environmentId={speechInput.transcriptionEnvironmentId}
Expand All @@ -4157,7 +4205,7 @@ export function ChatComposer(props: ChatComposerProps) {
// column-reverse pins the scroll to the bottom; the single inner div keeps the text in normal order.
<div
aria-label={gt("Live transcription")}
className="mx-3 mb-3 flex max-h-32 flex-col-reverse overflow-y-auto rounded-lg border border-border/60 bg-muted/30 px-3 py-2 text-body leading-relaxed break-words whitespace-pre-wrap sm:mx-4"
className="mx-3 mb-3 flex max-h-32 flex-col-reverse overflow-y-auto rounded-control surface-well px-3 py-2 text-body leading-relaxed break-words whitespace-pre-wrap sm:mx-4"
>
<div>
<span>{speechInput.preview.committed}</span>
Expand Down
8 changes: 6 additions & 2 deletions apps/web/src/components/chat/ComposerFooterControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export function ComposerPermissionsSection(props: {

export const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryActions(props: {
children?: React.ReactNode;
renderSpeechAction?: ((inPill: boolean) => React.ReactNode) | undefined;
compact: boolean;
canOperateThread: boolean;
isPreparingWorktree: boolean;
Expand Down Expand Up @@ -220,8 +221,9 @@ export const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryA
onResume: () => void;
onPreviousPendingQuestion: () => void;
onInterrupt: () => void;
onStopDictation?: (() => void) | undefined;
stopDictationShortcutLabel?: string | null;
compactBeforeSendTokens: number | null;
hideCompactToggle: boolean;
keepFullHistory: boolean;
onToggleKeepFullHistory: () => void;
}) {
Expand All @@ -247,12 +249,14 @@ export const ComposerFooterPrimaryActions = memo(function ComposerFooterPrimaryA
canResume={props.canResume}
preserveComposerFocusOnPointerDown={props.preserveComposerFocusOnPointerDown ?? false}
isEditingQueuedMessage={props.isEditingQueuedMessage}
renderSpeechAction={props.renderSpeechAction}
onSubmitMessage={props.onSubmitMessage}
onResume={props.onResume}
onPreviousPendingQuestion={props.onPreviousPendingQuestion}
onInterrupt={props.onInterrupt}
onStopDictation={props.onStopDictation}
stopDictationShortcutLabel={props.stopDictationShortcutLabel ?? null}
compactBeforeSendTokens={props.compactBeforeSendTokens}
hideCompactToggle={props.hideCompactToggle}
keepFullHistory={props.keepFullHistory}
onToggleKeepFullHistory={props.onToggleKeepFullHistory}
>
Expand Down
Loading
Loading