Skip to content

fix: keep the iOS keyboard down when tapping the mobile key bar - #19

Open
zarv1k wants to merge 1 commit into
cloudcli-ai:mainfrom
zarv1k:fix/keybar-no-soft-keyboard
Open

zarv1k wants to merge 1 commit into
cloudcli-ai:mainfrom
zarv1k:fix/keybar-no-soft-keyboard

Conversation

@zarv1k

@zarv1k zarv1k commented Oct 2, 2026

Copy link
Copy Markdown

Summary

Every tap on the mobile key bar ended in terminal.focus() — sendKey(), paste() and the CTRL/ALT handlers all called it — and focusing xterm's textarea is exactly what raises the soft keyboard. So with the keyboard dismissed (to read output, say), tapping ESC, an arrow or CTRL popped it back open over half the screen.

The key bar now records on pointerdown whether the terminal had focus, and restores focus after the tap only in that case:

  • keyboard down → the key reaches the shell and the keyboard stays down;
  • keyboard up → focus is kept, as before;
  • the keyboard button remains the explicit way to raise it.

sendKey() and paste() no longer move focus themselves; the key bar decides. Ctrl+Shift+V / ⌘V still paste with the terminal already focused.

Testing

  • npm run typecheck and npm run build pass.
  • Mounted the plugin in headless Chromium with touch emulation and a stub WebSocket: on main, tapping ESC with the terminal unfocused focuses it (keyboard opens); with this change it sends \x1b and focus stays where it was. With the terminal focused, tapping TAB sends \t and keeps focus.
  • Checked on an iPhone (installed PWA): the keyboard no longer pops up on key bar taps.
  • npm test: resize reaches the PTY and a dropped connection keeps the shell alive… fail on unmodified main too in my environment (Debian 13, Node 24). This change only touches the frontend.

Every key bar tap ended in terminal.focus() - sendKey(), paste() and the
CTRL/ALT handlers all called it - and focusing the terminal's textarea is
what raises the soft keyboard. Tapping ESC or an arrow with the keyboard
dismissed popped it back open over half the screen.

The bar now restores focus only when the terminal had it at pointerdown,
i.e. when the keyboard was already up. With the keyboard down, keys go to
the shell and it stays down; the keyboard button remains the explicit way
to raise it.
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