Skip to content

The agent that grows with you

fix(desktop): let the edit composer scroll long prompts

mollusk652ae4877a71
diff --git a/apps/desktop/src/components/assistant-ui/thread/user-edit-composer.tsx b/apps/desktop/src/components/assistant-ui/thread/user-edit-composer.tsx
index c54e9ec6f6c..901cf1dc724 100644
--- a/apps/desktop/src/components/assistant-ui/thread/user-edit-composer.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/user-edit-composer.tsx
@@ -805,7 +805,7 @@ export const UserEditComposer: FC<UserEditComposerProps> = ({ cwd, gateway, sess
autoCapitalize="off"
autoCorrect="off"
className={cn(
- 'ui-prompt-input-editor__input max-h-48 w-full resize-none bg-transparent p-0 pr-7 text-[length:var(--conversation-text-font-size)] text-foreground/95 outline-none',
+ 'ui-prompt-input-editor__input max-h-48 w-full resize-none overflow-y-auto bg-transparent p-0 pr-7 text-[length:var(--conversation-text-font-size)] text-foreground/95 outline-none',
'**:data-ref-text:cursor-default',
expanded ? 'min-h-16' : 'min-h-[1.25rem]'
)}
diff --git a/apps/desktop/src/components/assistant-ui/thread/user-message-edit.test.tsx b/apps/desktop/src/components/assistant-ui/thread/user-message-edit.test.tsx
index 7b89cacd643..dfd1a78c509 100644
--- a/apps/desktop/src/components/assistant-ui/thread/user-message-edit.test.tsx
+++ b/apps/desktop/src/components/assistant-ui/thread/user-message-edit.test.tsx
@@ -214,4 +214,26 @@ describe('click-to-edit user message', () => {
expect(container.querySelector('[data-slot="aui_edit-composer-root"]')).toBeTruthy()
})
})
+
+ // A long previous prompt is capped at max-h-48 in the edit composer. Without
+ // an overflow rule the overflow is clipped with no way to scroll, hiding the
+ // tail of the prompt. The editor must scroll its own overflow (like the main
+ // composer's editor does).
+ it('keeps the edit composer editor scrollable when the prompt overflows the cap', async () => {
+ const { container } = render(<IncrementalHarness onEdit={async () => {}} />)
+
+ const bubble = await screen.findByRole('button', { name: 'Edit message' })
+
+ fireEvent.click(bubble)
+
+ const editor = await waitFor(() => {
+ const node = container.querySelector('[contenteditable="true"]')
+ expect(node).toBeTruthy()
+
+ return node as HTMLElement
+ })
+
+ expect(editor.className).toContain('max-h-48')
+ expect(editor.className).toContain('overflow-y-auto')
+ })
})