Skip to main content
Follow along with the runnable example. This guide walks through the Dictation box example in corti-examples — bootstrap your build from it or use it as reference.
A dictation box is a classic speech-enabled-app workflow: dictate into a scratch box, refine the text, then transfer it into whichever form field you were working in, and navigate the form by voice along the way. A single microphone drives the whole thing. This guide combines two earlier building blocks: caret Text Insertion through an EditorAdapter, and the Commands declare → event → dispatch loop. The new idea is routing — deciding which control each dictation segment lands in.

The commands

The workflow is driven by a small command set: two to control routing, one to transfer, and two to navigate the form.
JavaScript

Route dictation to the right target

By default, final dictation inserts at the caret of whatever control is focused — exactly like typing. The one exception is the box-target override: after target dictation box, dictation goes into the scratch box while the form field keeps its focus and caret.
JavaScript
To make transfer text work, track the last-active field that isn’t the box — that’s the transfer destination. A focusin listener records it, and focusing any field clears the override.
JavaScript

Transfer the box into a field

transfer text inserts the box’s contents at the caret of the last-active field — reusing the same boundary-aware insert — then clears the box and the override.
JavaScript

go to {field} focuses a text field (caret to end) or opens a dropdown. pick {number} selects an option — parse the spoken value so both "two" and "2" resolve to the same 1-based index.
JavaScript
A native <select> can’t be opened or selected-by-index programmatically, so dropdown fields need a custom listbox (a button + option list) exposing an imperative open/pick handle. Text fields work directly through the EditorAdapter.

Next steps

Text Insertion

The caret-insertion EditorAdapter that box and field writes reuse.

App Control

Drive non-text UI — tabs, panels, dialogs — by voice.

Example code

The complete, runnable Dictation box example in corti-examples.
Please contact us for help or questions.