| ... | ... | @@ -1210,7 +1210,11 @@ function ComposerPromptEditorTiptapInner(props: ComposerPromptEditorProps) { |
| 1210 | 1210 | const focusAt = useCallback( |
| 1211 | 1211 | (nextCursor: number) => { |
| 1212 | 1212 | if (!editor) return; |
| 1213 | | editor.view.dom.focus({ preventScroll: true }); |
| 1213 | // view.focus() writes the state selection to the DOM as it focuses. A |
| 1214 | // bare DOM focus leaves the native caret at the start until |
| 1215 | // ProseMirror resyncs it 20ms later, and dictation tools type fast |
| 1216 | // enough to land keys there, ahead of the text already inserted. |
| 1217 | editor.view.focus(); |
| 1214 | 1218 | // A newer prompt is waiting to be applied (a chip was just inserted |
| 1215 | 1219 | // through the store). Reporting the editor's stale text now would |
| 1216 | 1220 | // overwrite that prompt; the pending rewrite places the caret instead. |