Skip to content

The agent that grows with you

fix(desktop): keep the mid-run composer input full-width (#99728)

aydnOktay3e1539ba1d20
diff --git a/apps/desktop/src/app/chat/composer/composer-utils-width.test.ts b/apps/desktop/src/app/chat/composer/composer-utils-width.test.ts
new file mode 100644
index 00000000000..c3d6255826f
--- /dev/null
+++ b/apps/desktop/src/app/chat/composer/composer-utils-width.test.ts
@@ -0,0 +1,15 @@
+import { describe, expect, it } from 'vitest'
+
+import { composerInputWidthClass } from './composer-utils'
+
+describe('composerInputWidthClass', () => {
+ it('fills the unstacked 1fr grid track instead of the 8rem inline floor', () => {
+ expect(composerInputWidthClass(false)).toBe('w-full min-w-0')
+ expect(composerInputWidthClass(false)).not.toContain('composer-input-inline-min-width')
+ expect(composerInputWidthClass(false)).not.toContain('flex-1')
+ })
+
+ it('keeps the stacked editor full-width', () => {
+ expect(composerInputWidthClass(true)).toBe('w-full')
+ })
+})
diff --git a/apps/desktop/src/app/chat/composer/composer-utils.ts b/apps/desktop/src/app/chat/composer/composer-utils.ts
index ab9c2a0577d..cfb58acef07 100644
--- a/apps/desktop/src/app/chat/composer/composer-utils.ts
+++ b/apps/desktop/src/app/chat/composer/composer-utils.ts
@@ -68,6 +68,19 @@ export function shouldDisableComposerInput(disabled: boolean, gatewayState: Conn
export const pickPlaceholder = (pool: readonly string[]) => pool[Math.floor(Math.random() * pool.length)]
+/**
+ * Width classes for the unstacked vs stacked composer editor.
+ *
+ * The inline (unstacked) editor lives in a CSS-grid `1fr` column — not a flex
+ * row — so `flex-1` never grows it. Pairing that with
+ * `--composer-input-inline-min-width` (8rem) pinned the field to the ~129pt
+ * sliver measured in #99728 while mid-run controls kept their intrinsic width.
+ * `w-full min-w-0` fills the grid track and lets the column shrink cleanly.
+ */
+export function composerInputWidthClass(stacked: boolean): string {
+ return stacked ? 'w-full' : 'w-full min-w-0'
+}
+
/** Completion items can carry an `action` (set in use-slash-completions) that
* runs a side effect on pick instead of inserting a chip — e.g. the session
* picker's "Browse all…" entry opens the overlay. Table-driven so new action
diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx
index 2431cdd6a09..52a8f22718f 100644
--- a/apps/desktop/src/app/chat/composer/index.tsx
+++ b/apps/desktop/src/app/chat/composer/index.tsx
@@ -46,6 +46,7 @@ import { AttachmentList } from './attachments'
import {
acceptsTriggerCompletion,
COMPOSER_FADE_BACKGROUND,
+ composerInputWidthClass,
implicitSlashAcceptIndex,
liveComposerDraft,
type QueueEditState,
@@ -1165,8 +1166,10 @@ export function ChatBar({
/>
)
+ const inputWidthClass = composerInputWidthClass(stacked)
+
const input = (
- <div className={cn('relative', stacked ? 'w-full' : 'min-w-(--composer-input-inline-min-width) flex-1')}>
+ <div className={cn('relative', inputWidthClass)}>
<div
aria-disabled={inputDisabled ? true : undefined}
aria-label={t.composer.message}
@@ -1178,7 +1181,7 @@ export function ChatBar({
'min-h-[1.625rem] min-h-(--composer-input-min-height) max-h-(--composer-input-max-height) cursor-text overflow-y-auto whitespace-pre-wrap break-words [overflow-wrap:anywhere] bg-transparent pb-1 pr-1 pt-1 leading-normal text-foreground outline-none disabled:cursor-not-allowed',
'**:data-ref-text:cursor-default',
stacked && 'pl-3',
- stacked ? 'w-full' : 'min-w-(--composer-input-inline-min-width) flex-1',
+ inputWidthClass,
// Inside the native Wayland HUD drag region: a drag region swallows
// the page's mouse input whole, so the input must opt back out or it
// becomes unclickable. Buttons use the global no-drag rule.