fix(android): handle hardware Enter without breaking IME input#101360
Conversation
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
f078cea to
0e2eb71
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 7, 2026, 1:13 AM ET / 05:13 UTC. Summary PR surface: Other +273. Total +273 across 5 files. Reproducibility: yes. The linked issue has a live Android 15/API 35 Gboard repro after the first fix, and current main source confirms repeated Enter returns false to the text field after the initial send. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this PR or an equivalent shared Android hardware-key handler after exact-head CI, preserving IME ownership, Shift+Enter, and both composer surfaces. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue has a live Android 15/API 35 Gboard repro after the first fix, and current main source confirms repeated Enter returns false to the text field after the initial send. Is this the best way to solve the issue? Yes. The shared Android UI handler is the narrow owner-boundary fix because it covers both composer surfaces at Compose's pre-soft-keyboard hardware-key boundary without adding config, gateway, or protocol behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6192b037bbb5. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Other +273. Total +273 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
0e2eb71 to
fea9a5b
Compare
fea9a5b to
88b233c
Compare
|
Land-ready at prepared head Evidence:
Known proof gap: Trime's native raw-preedit text differs from transliterated commit behavior in this emulator setup, but physical and on-screen Enter match; the app-specific event ownership and composition behavior are covered. |
|
Merged via squash.
|
Closes #101239
What Problem This Solves
Fixes Android hardware-keyboard Enter handling that could leak repeated key-downs into the cleared chat composer, inserting a newline after the message had already sent. The same one-event interception also risked claiming Enter while an IME was still composing text.
Why This Change Was Made
Both Android composer implementations now share one package-owned hardware-key state machine and String-to-
TextFieldValueadapter. They intercept physical keys at Compose's pre-soft-keyboard boundary, preserve public composition state, account for IMEs that keep hardware preedit private, and track ownership for the full Enter sequence. Each composer still uses its existing send callback; no config, protocol, or gateway surface was added.User Impact
Physical-keyboard users can press Enter to send once, including during key repeat, without leaving a newline in the next draft. Shift+Enter continues to insert a newline, blank Enter remains a no-op, on-screen keyboard input is unchanged, and composing IMEs get the first Enter needed to commit their input before a later Enter can send.
Evidence
\nin the cleared composer at780ca1d25315b34d3118e1db2d8dcafcc16415f3.line1\nline2; Gboard's on-screen Enter still inserted a newline rather than invoking hardware send.nihaopreedit remained IME-owned even with committed draft text already present; physical Enter committed text instead of sending the partial draft. Trime's raw-preedit commit matched its on-screen Enter behavior in the same environment.tbx_01kwxeq31y8q66en8zhv16stym(tidal-krill):pnpm native:i18n:check, focusedChatHardwareKeyTestfor Play and third-party variants, both debug assemblies, and both debug lint tasks passed.