Skip to content

iOS: dictation can land in a different field after you move focus while it’s still processing #346

Open

Description

@rajgharat07

What happened?

On the iPhone keyboard, if I release a dictation and then tap into another field before “Pasted,” the words often show up in the field I moved to — not the one I spoke into.

Looking at the App Group side, that lines up with how results are addressed. KeyboardCommand and presence already carry a controllerID (one host field). DictationResult only carries a process recipient. resultArrived() checks that the result is for this KeyboardProcess.id, then inserts into whatever textDocumentProxy is live. appeared() also calls resultArrived() unconditionally, so a new controller in the same extension process can pick up a pending result after blur / host switch.

So the process can be the right one and the field still wrong. Processing is allowed to outlive leaving the original field (clipboard handoff), which is the window where this happens.

Steps:

  1. Blurt keyboard + Full Access, listening window up, key set.
  2. Focus field A (Notes title, Messages search, etc.), dictate something distinctive, release so it shows processing — don’t cancel.
  3. Before Pasted, tap field B in the same app (or jump to another app that also uses Blurt; same process often gets reused).
  4. See which field gets the text.

Expected: insert only into the controller that owned the press/stop, or fall back to clipboard if that field is gone.

Actual: process-addressed result inserts into the new field’s proxy.

Useful spots:

  • App/BlurtiOS/BlurtiOSCore/SharedState.swift — DictationResult.recipient only; KeyboardCommand has controllerID
  • KeyboardRelayInjector.swift — builds the result with process id
  • KeyboardModel+Phase.swift — resultArrived()
  • KeyboardModel+Presence.swift — appeared() → resultArrived(); endOwnedDictation leaves .processing alone
  • DESIGN.md — result addressing is process-scoped; presence is process + controllerID

Fix I’d try: put controllerID on DictationResult from the accepted press/stop, and only insert when it matches self.controllerID (else leave it for the owner / clipboard timeout).

Related but not the same as #344: that one is stopRecipient routing to the wrong keyboard process, and a cancelled result left in SharedStore. This is successful processing, correct process, wrong field because controllerID never rides the result.

macOS and Blurt versions

iOS 18+ · Blurt iOS keyboard from main

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions