Voice input for a question, with review, confirmation and a non-voice fallback
Use voice only as an optional way to enter a question. A person can review and edit the transcript, confirm it before it is used, and type the same question by keyboard at any time. Voice is never the only method.
Audit: what this pack shows today
Read this section before you build. It states only what pack app-campus.site.2 contains.
| Surface | Voice input found | Pattern and gap |
|---|---|---|
| Ayuda en español, public/guides/spanish-help.html | Yes. One dictation button named Dictar pregunta en inglés, using browser SpeechRecognition with language en-US, interimResults off and continuous off. | Final transcript text is appended directly to the question field. The page tells the reader to review and edit before copying, but there is no interim preview, no explicit confirmation step, and no undo for a dictated segment. Error handling exists for microphone permission, no speech, missing microphone and network failure, and typing remains available when SpeechRecognition is absent. |
| All other guides in this pack | No SpeechRecognition use was found in any other file in this pack. | No reusable voice pattern for a question field exists in this pack. A builder would have to invent the states, review step and fallback again for each field. |
| Ask in the signed-in app | No Ask screen file is in this pack. This pack holds public guides only, so the Ask implementation cannot be confirmed from this pack. | The implementation plan below is written for the app slice, using the public guide demo on this page as the reference pattern. It adds no sign-in path, no role and no new permission. |
Comparison: SpeechRecognition and accessible dictation patterns
Use this comparison to choose a pattern. None of these patterns is required for a person to ask a question.
| Pattern | How it works | Limits to state on screen | Review and fallback needed |
|---|---|---|---|
| Browser SpeechRecognition, Web Speech API | A browser service turns microphone audio into text in the page. Interim results can show words while a person speaks, and final results can be inserted into a field. | Availability varies by browser. The API is not standard in every browser, microphone permission is required, recognition can fail on network or on background noise, and the browser service may process audio to produce the transcript. Accuracy varies by language, accent and noise, so a transcript must never be sent or saved without review. | Show interim text in a preview, insert final text only after it is final, require an explicit confirmation before copy or send, offer undo and clear, and keep typing as a complete alternative on every screen. |
| Operating system or browser dictation | A person uses the dictation built into their device, which inserts text at the focused field, and then edits that text by keyboard. | The site cannot control this dictation, its languages, its privacy handling or its accuracy. Instructions must not claim the site records or controls it. | The field must accept pasted and dictated text like typed text, must show the field for editing, and must never require the site button to be used. State that dictation is optional and that review by keyboard is part of the flow. |
| Accessible dictation pattern used on this page | One control starts and stops dictation, interim words appear in a separate preview, final words are added to the field, the person edits the field, and a separate confirmation control copies or submits the reviewed text. | Speech and language limits, microphone permission, and the fact that audio is used only while listening and no audio is kept by this page. The same limits apply on Ask. | Keyboard operation for every control, visible focus, status messages announced once, Escape to stop, undo for the last dictated segment, clear, and a full typing path with the same result. |
Design rules that apply to every pattern
- Voice is optional. Every task that voice can start can also be done by typing, pasting or operating system dictation, with the same outcome.
- No transcript is copied, sent or saved until the person reviews it in the field and chooses a separate confirmation control.
- Interim text is a preview only. It is never counted as a final question and never sent.
- A person can stop dictation at any time, edit the result, undo the last segment, or clear the field, by keyboard and by pointer.
- When voice is unavailable or fails, the screen states that plainly, keeps the field and any text already entered, and moves focus to the field.
Accessibility rules for the control
- The start and stop control is a native button with a pressed state, an accessible name that states the current action, and a target of at least 44 pixels.
- Listening state, interim text, errors and confirmation are announced in a status region, without moving focus while a person is speaking.
- Focus stays visible by keyboard, returns to the question field after dictation ends, and after an error, and order matches visual order.
- No time limit applies without a way to stop. Dictation stops on Escape, on stop, on page hide, and after 60 seconds, and the stop is announced.
- Colour alone never shows listening state. Text states Listening, Stopped or Not available.
Try the pattern on this page
Example only. Nothing entered here is sent to a server and no college record is created. Use the controls in order: dictate if voice is available, review the text in the field, edit it, then confirm. Typing the whole question without voice gives the same result.
Choose the language you will speak. The question field keeps the same text whatever language is chosen.
Type, paste or dictate the question here. Review this text before you confirm it. Voice is optional.
No interim text. Interim words appear here while you speak and are not added to the question until they are final.
Preview only. It is not copied, sent or saved.
Dictation is optional. The microphone is used only while listening. This page does not record or keep audio. The browser service that produces the transcript may process audio for recognition. Do not dictate personal details. Press Escape to stop. If dictation is not available, type the question instead.
Dictation not started. Type the question, or choose Start dictation if voice is available in this browser.
```mermaid
flowchart TD
A[Idle, typing always available] --> B[Start dictation]
B --> C[Listening, interim preview only]
C --> D[Final segment added to field]
D --> E[Review and edit in field]
E --> F[Confirm and copy or send]
C --> G[Error or stop]
G --> A
D --> A
```Implementation plan for Ask
Ship this plan in the app slice, through the normal build. It changes the Ask question field only. It adds no sign-in path, no role, no permission, no source and no fact to any answer.
Step 1: Add the control beside the question field on Ask
Add one native Start dictation and Stop dictation button beside the question field, with a language choice limited to the languages the college offers for that assistant, and the same help text, privacy note and fallback wording as the demo on this page. Keep the field, its label, its helper text and its error text in the order stated in Form field standard.
Step 2: Add the interim preview and the status region
Render interim text in a preview region with aria-live polite and atomic true, separate from the field. Announce Listening, Stopped, Transcript added for review, Confirmed, and each error once in the status region. Do not move focus while a person is speaking.
Step 3: Insert final segments only, with undo
Use SpeechRecognition with interimResults true, continuous false and maxAlternatives 1 where the browser supports it. Append final segments to the field, keep a stack of values before each segment for undo, and cap the field at the existing question limit. Stop after 60 seconds, on Escape, on stop, and on page hide, and announce the stop.
Step 4: Require review and confirmation in the existing flow
After a final segment, move focus to the question field, select the added segment where the platform allows it, and state Transcript added. Review the text, edit if needed. The existing Ask submit control, labelled with a verb and object as in Form field standard, remains the only confirmation. Dictation alone never submits, copies or saves a question.
Step 5: Handle unsupported browsers and each error as a fallback to typing
When SpeechRecognition is absent, disable the dictation control, show Dictation is not available in this browser. Type the question instead, and keep every other control working. For not-allowed or service-not-allowed, show Microphone permission was not given. Type the question instead. For no-speech, audio-capture, network, aborted and language errors, show the matching plain reason, keep text already entered, and move focus to the field. Never show a raw error name as the only message.
Step 6: Keep the same rules as the rest of the app
Keep the question in one college workspace and one assistant, keep test sessions labelled as test and excluded from counts, keep answers drawn only from approved sources, and keep personal questions signed in. A visitor widget keeps public approved sources only and shows the same fallback wording. Do not store audio, transcripts or interim text as a record, and do not add a voice, language or length limit to any model request.
| State | Screen text | Focus and next action |
|---|---|---|
| Idle | Start dictation. Dictation is optional. Type the question instead. | Question field is reachable in document order. Start dictation is a native button with pressed state false. |
| Listening | Listening. Interim text appears in the preview only. Press Escape or Stop dictation to stop. | Focus is not moved while listening. The button shows Stop dictation with pressed state true. |
| Final segment added | Transcript added. Review the text, edit if needed, then use the existing Ask submit control. | Focus moves to the question field. Undo and Clear are available. |
| Error or unsupported | The matching plain reason, plus Type the question instead. Text already entered is kept. | Focus moves to the question field. No submit occurs. |
| Confirmed by submit | The existing Ask result flow only. No separate voice confirmation message is shown as an answer. | Focus follows the existing Ask result heading rule. |
Checks before you ship voice input
Run each check on phone and desktop, with keyboard, screen reader and voice, in a test college workspace. If a check fails, fix it before you publish.
- Dictate a question, confirm interim words appear in the preview only, confirm final words are added to the field, edit the field, and confirm no copy, save or send happens before the existing Ask submit control is used
- Type the same question without voice and confirm the same Ask result, with the same source check as in Ask and check sources
- Stop dictation with Escape, with the stop control, and by leaving the page, and confirm no audio is kept and focus returns to the field
- Undo the last dictated segment and clear the field, and confirm text typed before dictation is restored by undo and is not lost by an error
- Block microphone permission, use a browser without SpeechRecognition, and simulate network failure, and confirm each case shows a plain reason, keeps entered text, and leaves typing fully available
- Confirm every control is at least 44 pixels high, focus stays visible, status messages are announced once, and no timeout applies without a stop control
- Confirm a test session shows no saved claim for a dictated question, a visitor sees public sources only, and no transcript, audio or interim text appears in reports, counts or exports
Follow Ask and check sources for the source check after a dictated question, Form field standard for label, helper, error and primary action order, and Accessibility where that guide is linked from the site footer for the access commitment.
Next guide
Ask in plain words, check each source, and keep the answer with its sources.