diff --git a/apps/desktop/src/app/chat/composer/index.tsx b/apps/desktop/src/app/chat/composer/index.tsx index 21034f68af..e13df39b7b 100644 --- a/apps/desktop/src/app/chat/composer/index.tsx +++ b/apps/desktop/src/app/chat/composer/index.tsx @@ -1006,21 +1006,30 @@ export function ChatBar({ {attachments.length > 0 && } - {stacked ? ( - <> - {input} -
- {contextMenu} - {controls} -
- - ) : ( -
- {contextMenu} - {input} - {controls} -
- )} + {/* + Single CSS Grid keeps {input} (and the contenteditable inside + it) in a stable parent across the stacked/inline toggle. + Earlier this was a JSX conditional that rendered {input} + inside two different fragments — when `stacked` flipped (e.g. + the moment text wrapped past two lines and the auto-expand + effect triggered), React reconciled them as different + positions and unmounted/remounted the contenteditable. The + fresh mount started empty and any in-flight characters were + lost. Switching the layout via grid-template-areas keeps the + exact same DOM nodes and lets the browser handle the reflow. + */} +
+
{contextMenu}
+
{input}
+
{controls}
+