Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/web/src/components/ComposerPromptEditorTiptap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,11 @@ function ComposerPromptEditorTiptapInner(props: ComposerPromptEditorProps) {
const focusAt = useCallback(
(nextCursor: number) => {
if (!editor) return;
editor.view.dom.focus({ preventScroll: true });
// view.focus() writes the state selection to the DOM as it focuses. A
// bare DOM focus leaves the native caret at the start until
// ProseMirror resyncs it 20ms later, and dictation tools type fast
// enough to land keys there, ahead of the text already inserted.
editor.view.focus();
// A newer prompt is waiting to be applied (a chip was just inserted
// through the store). Reporting the editor's stale text now would
// overwrite that prompt; the pending rewrite places the caret instead.
Expand Down
Loading