authorgravatar for otavio@ossystems.com.brOtavio Salvador <otavio@ossystems.com.br> 2026-10-07 18:03:31-03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-07 14:03:31-07:00
log26285ab80513260d1ff29d2c3fbe18f21990cb62
treedf3d9aa7114ca106f5919d5b7760b79a48ce7ed8
parenteba0521563946a0834af881465d3e1ff7a4ca2f1
signature Signed by PGP key B5690EEEBB952194

fix(web): fast typing no longer scrambles text when type-to-focus kicks in (#14595)


1 files changed, 5 insertions(+), 1 deletions(-)

apps/web/src/components/ComposerPromptEditorTiptap.tsx+5-1
......@@ -1210,7 +1210,11 @@ function ComposerPromptEditorTiptapInner(props: ComposerPromptEditorProps) {
12101210 const focusAt = useCallback(
12111211 (nextCursor: number) => {
12121212 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();
12141218 // A newer prompt is waiting to be applied (a chip was just inserted
12151219 // through the store). Reporting the editor's stale text now would
12161220 // overwrite that prompt; the pending rewrite places the caret instead.