Skip to content

fix(web): keep dictating when the tab or app goes to the background - #11

Merged
mdatagent merged 1 commit into
customfrom
fix/voice-background-tab
Oct 25, 2026
Merged

mdatagent merged 1 commit into
customfrom
fix/voice-background-tab

Conversation

@mdatagent

Copy link
Copy Markdown
Collaborator

Martin's report: dictation stopped as soon as he switched to another browser tab or opened a link (e.g. levels.fyi) while still talking.

Existing systems changed

  1. Web voice input control (apps/web/src/voice-input/VoiceInputControl.tsx): the page becoming hidden no longer ends a recording.
    1. Root cause: since fix(web): keep dictation when the phone screen turns off #9, visibilitychange → hidden called controller.stop() while recording, so switching tabs, opening a link in a new tab, or switching apps stopped the recording and sent the partial audio for transcription. The browser itself keeps capturing: in both Chromium and Firefox 158 the microphone track stays live and audio keeps arriving while the tab is in the background. Martin's diagnostics on 2026-10-25 09:02:19 UTC show exactly this: visibility: hidden and phase: transcribing in the same millisecond.
    2. Hidden while recording: recording continues. The Stop button's timer reflects the real elapsed time on return, since it is computed from the start time.
    3. Screen wake lock: the browser releases it when the page is hidden; the control now takes it again when the page becomes visible and voice input is still preparing or recording.
    4. Hidden while the microphone is starting: unchanged; it still ends with "Voice input stopped when the app moved to the background."
    5. Phone screen locked while recording: this also continues recording now (previously it stopped and transcribed). If the browser or OS mutes or ends the microphone track in the background, the existing handlers apply: a mute shows "The microphone was muted…", and an ended track stops and transcribes what was captured.

Verifiable outcome

Local dev server with a fake ElevenLabs key (transcription fails with "rejected the API key", which shows the audio reached the server). Real tab switch in one window: record ~3 s, open and activate a second tab for ~9 s, switch back, record ~2 s more, press Stop.

  1. Chromium 1217, before: the T3 tab went hidden, recording stopped at 3.2 s and was sent for transcription; no Stop button on return.
  2. Chromium 1217, after: still recording on return (Stop · 0:13), one 15.9 s recording, wake lock re-granted on return.
  3. Firefox 158 desktop, before: stopped at 3.6 s when hidden.
  4. Firefox 158 desktop, after: one 16.2 s recording; the level monitor saw signal in every window, including the background period (no muted or silent windows).

Not verified on Android: the emulator's display hung under load, so Firefox/Chrome for Android background capture and screen-lock behaviour still need a check on the phone.

🤖 Generated with Claude Code

Hiding the page (switching browser tabs, opening a link, switching apps)
stopped the recording and sent it for transcription. Recording now
continues while the page is hidden, and the screen wake lock is taken
again when the page becomes visible. Hiding the page while the
microphone is still starting behaves as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Oct 25, 2026
@mdatagent
mdatagent merged commit c0ecb19 into custom Oct 25, 2026
7 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant