Skip to content

Dictation inserts text only at end of field instead of at caret #178

@rosscado

Description

@rosscado

Expected: When dictating, transcribed text should be inserted at the caret position, preserving any text before and after. If the caret cannot be determined, insert at the end.
Actual: Transcribed text is always appended to the end of the target field.

Steps to Reproduce:

  1. Focus a text field with existing content (e.g., type “Hello |world”, caret between “Hello” and “world”).
  2. Start dictation and speak a short phrase.
  3. Observe that text is appended at the end rather than inserted at the caret.

Impact: Breaks editing workflows; users cannot dictate into the middle of text without losing position.

Proposed Fix:

  • Update input/textarea insertion to use selectionStart/selectionEnd when available.
  • Insert computed delta at caret during accumulation; use replace-all only when server-merges or out-of-order corrections happen.

Acceptance Criteria:

  • Dictated text inserts at caret for inputs/textarea and contenteditable editors.
  • Pre-existing text is preserved before and after insertion point.
  • The caret position should advance after insertion, as if the user had typed the text.
    -- E.g. "Hello |world" + "beautiful" -> "Hello beautiful |world"
  • Out-of-order responses and server merges still produce correct final text.
  • A new unit test(s) are introduced to cover this scenario; they fail before the fix and pass after.
  • All tests pass, including out-of-order and formatting cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Universal dictationSpeech-to-text transcription anywhere on the web.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions