Skip to content

Dictation: land the first press in Chromium web fields - #95

Merged
MarcusJRLee merged 3 commits into
mainfrom
fix/web_first_dictation
Nov 17, 2026
Merged

MarcusJRLee merged 3 commits into
mainfrom
fix/web_first_dictation

Conversation

@MarcusJRLee

Copy link
Copy Markdown
Owner

Problem

On gemini.google.com in Brave, the first pedal press after the browser started (or dropped its accessibility tree) often did nothing; the next press worked. Reproduced in a fresh Brave 1.99.55 (Chromium 157) profile with the editor focused: 3 of 4 first presses failed, each in one of three ways:

  • no focused field (Brave exposes none until an app-level AX request);
  • the page's AXWebArea itself accepted as a web target, so keystrokes went to BODY and were dropped while delivery reported success;
  • the captured caret offset flipped 10↔38 ~1 s later with no caret move, so delivery refused with caretChanged.

Change

  • AccessibilityFocusedTextTargeting.capture() treats no-editable-focus as settling: on the first such read it reads the frontmost app's AXRole (the request that wakes Chromium's page tree), then re-reads every 10 ms for ≤ 500 ms. Secure fields and selections still fail at once. Capture stays synchronous so queued commands keep their order.
  • Web targets must expose settable AXSelectedText; a bare web area or group is never a target.
  • Web carets are revalidated by AXSelectedTextMarkerRange (stable across the offset flips, changes on a real caret move — both measured).
  • New --verify-focused-text-delivery PID MARKER diagnostic and opt-in scripts/check_web_text_delivery.sh: a cold throwaway Chromium instance on a local Gemini-shaped page, first press, ~1.5 s. It focuses a window, so it is not in install_app.sh.
  • Removes the never-runnable HC_RUN_WEB_TARGET_INTEGRATION test the script supersedes.

Evidence

Run First press
Gemini, before 1 of 4 landed
Gemini, wake only (1 s hold) 5 of 6 landed; every miss was the 10↔38 flip
Fixture check, with wake passed, capture 35 ms
Marker guard unit tests only; live Gemini rerun still open

scripts/check.sh passes.

Alternatives

Criterion App-role wake + bounded settle (chosen) AXManualAccessibility / AXEnhancedUserInterface Async capture with retries Keep-alive AX polling
Works in Brave 🟢 measured 🔴 rejected (-25205/-25208) 🟢 same mechanism 🟢
Ordering and safety 🟢 synchronous, queued commands keep order 🟢 🟠 actor reentrancy: a release during capture can strand a session 🟢
Cost 🟢 one AX call, failure path only 🟠 AXEnhancedUserInterface has known side effects 🟢 🔴 always-on Chromium AX cost, polling
Browser identity 🟢 none inspected 🟢 🟢 🟢

Recommendation: app-role wake with a bounded synchronous settle.

Criterion Text-marker caret (chosen) Numeric offset Drop the web caret guard
Survives page text changes 🟢 measured 🔴 flips 10↔38 🟢
Detects caret moves 🟢 measured 🟢 🔴 none

Recommendation: compare web carets by text marker, falling back to the offset when no marker is exposed.

Flag: none (pre_launch)

🤖 Generated with Claude Code

MarcusJRLee and others added 3 commits November 17, 2026 10:51
Brave builds a page's accessibility tree only after an application-level
request, so the first press after it started or dropped its tree found no
field, accepted the page's web area and typed into the body, or tripped a
caret guard; the next press worked. Capture now wakes the tree with one
app-role read on its first settling read and re-reads for up to 500 ms;
web targets must expose settable selected text; and web carets are
revalidated by AXSelectedTextMarkerRange, because Gemini's numeric offset
flips 10<->38 while the caret never moves.

Adds the --verify-focused-text-delivery diagnostic and the opt-in
scripts/check_web_text_delivery.sh cold-browser first-press check (~1.5 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MarcusJRLee
MarcusJRLee merged commit f398dc1 into main Nov 17, 2026
7 of 8 checks passed
@MarcusJRLee
MarcusJRLee deleted the fix/web_first_dictation branch November 17, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant