Skip to content

fix(terminal): a key-bar tap on Android leaves a keyboard Back put away down - #3297

Merged
devswha merged 2 commits into
mainfrom
fix/android-keybar-ime
Nov 7, 2026
Merged

devswha merged 2 commits into
mainfrom
fix/android-keybar-ime

Conversation

@devswha

@devswha devswha commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Refs #3274 (the key-bar half; the connection half waits on the reporter's details, asked on the issue).

Problem

On Android, Back puts the soft keyboard away but leaves the terminal's field (xterm's textarea in Direct typing, the input line otherwise) focused. Chrome on Android raises the keyboard again on any tap while a text field is focused, so every key-bar tap (arrows, Esc, Tab, Ctrl) brought the keyboard back. #1632 had stopped key taps from moving the focus, but the existing regression starts with nothing focused, which misses this case.

Reproduced on an Android 15 emulator (Chrome, google_apis x86_64 image) against an isolated test server: tap the grid (keyboard up), Back (dumpsys input_method: mInputShown=false, focus still on xterm-helper-textarea), tap Esc or Tab: mInputShown=true.

Fix

src/components/KeyBar.tsx: on the touch press of a key that leaves the focus alone (a key, a modifier, More keys; not the mode switch, Paste, Attach or the keyboard control, which move the focus or the keyboard themselves), the focused field carries inputmode="none" until the tap's click has been handled, then gets its own inputmode back (also at the next press anywhere, when the touch turns into a scroll, or when the field loses the focus). Chrome reads inputmode=none as "no keyboard", and a keyboard that is up stays up. A field that already asks for none (Settings > Terminal > Keyboard only from the key bar) is left alone.

This follows Termux's extra-keys row: a key is input, never a request for the keyboard; only the keyboard control raises it. No new control or setting.

Validation

  • Failing first: scripts/keybar-focus-regression.ts gains a touch case with the field focused (the state Back leaves): at the key's click the field must carry inputmode="none", keep the focus, send the key once, and get its inputmode back. It failed on main ([null] vs ["none"]) and passes with the fix.
  • Android 15 emulator Chrome, real taps (adb shell input tap), fixed build: keyboard down + Esc, Tab: stays down (mInputShown=false), field's inputmode restored; a grid tap still raises it; with the keyboard up, Esc and Tab keep it up.
  • In the CI runner image (herdr-ci-runner:local, standalone clone at this head): bun run check fast green (unit: 12986 pass, 0 fail). Browser regressions that name the key bar: through scripts/ci-browser-parallel.ts 9/9 passed (ui-contexts-regression, which runs keybar-focus, command-outcome-demo, key-bar-customization-demo, key-bar-hold-repeat, settings-pages-demo, sticky-modifiers, terminal-autoswitch-demo, terminal-keyboard-demo, terminal-paste-insert-demo); run directly, chat-size, mobile-tabs, terminal-attach, terminal-input and terminal-input-spacing passed.
  • Skipped: terminal-ipad-ime-regression.ts cannot launch there (it wants /opt/google/chrome, which the image lacks); it fails the same way on main and is not in scripts/ci-browser.sh.
  • Not checked: a build of the Android app itself (its WebView is the same Chromium as the emulator's Chrome), iOS Safari (the change only sets an attribute for the tap's length).

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 14 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 31814ee and 1a1b262.

Files selected for processing: 3

  • changelog.d/android-key-bar-keyboard.md
  • scripts/keybar-focus-regression.ts
  • src/components/KeyBar.tsx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…lone, More keys included; release on a cancelled touch
@devswha

devswha commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Review round on bc14944 (omo review BLOCK, Codex: no HIGH). Fixed in 1a1b262:

  • MEDIUM (omo + Codex): the Input line mode switch took the hold, and its blur restored the xterm field's inputmode over the none the mode switch sets on purpose. The hold now applies only to keys that leave the focus alone (keys, modifiers, More keys); the mode switch, Paste, Attach and the keyboard control are left as they were.
  • MEDIUM (Codex): More keys, a command, still raised a keyboard Back had put away. It now takes the hold; the regression checks it (field asks for none at its click, gets its inputmode back after).
  • LOW (omo): a touch that turns into the row's scroll (pointercancel, no click) left none until the next press. Released on pointercancel now.
  • LOW (omo, not done): no regression case for "Keyboard only from the key bar"; with it on the field already carries none and the hold skips it, which is a one-line early return.
  • LOW (noted): if that opt-in setting flips the field to none during a key's tap (the keyboard measured going down mid-tap), the release puts back the field's earlier value; the setting's own effect sets it again on its next change.

Re-verified at 1a1b262: Android 15 emulator Chrome (Esc and More keys with the keyboard put away: stays down; grid tap still raises it), bun run check fast green and the 9 CI key-bar browser scripts 9/9 plus terminal-input and mobile-tabs in the runner image. CodeRabbit was rate-limited on this PR.

@devswha
devswha merged commit f7f9546 into main Nov 7, 2026
15 checks passed
@devswha
devswha deleted the fix/android-keybar-ime branch November 7, 2026 22:10
@devswha

devswha commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

Merge note (merge pass) at head 1a1b262:

  • Merged on GitHub's required checks, all green on this head (Fast checks, Integration and browser, Native Windows install).
  • omo review receipt: CLEAR at this exact head. Unresolved review threads: 0 (GraphQL). CodeRabbit: neutral; no CodeRabbit review ran on this head.
  • Refs Android: connection never succeeds; bottom action bar taps (even arrow keys) open the IME #3274 (the Android key-bar half only; the connection half waits for the reporter's details, so Android: connection never succeeds; bottom action bar taps (even arrow keys) open the IME #3274 stays open). On Android, a tap on a key, modifier or More keys sets inputmode=none on the focused field for that tap, so a keyboard put away with Back stays down. Failing-first keybar-focus regression; checked on an Android 15 emulator; the 9 key-bar CI scripts and the chat-size, mobile-tabs, terminal-attach, terminal-input and spacing scripts green. The PR body's closing keyword was changed to a reference before merging.

@devswha devswha mentioned this pull request Nov 7, 2026
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