Keep the mobile keyboard down through a slow channel load #48

Merged
pedromcaraujo merged 1 commit from fix-mobile-keyboard-channel-switch into main 2026-10-15 10:14:37 +01:00

Summary

Switching channels on a phone pops the soft keyboard again — a regression of the inputmode="none" fix (2411786).

suppressTermKeyboard only re-applied inputmode="none" for 250ms after the iframe load. Since #41 we know xterm often builds its textarea well past half a second (ttyd boots, websocket reconnects), so the suppression ran out before the textarea existed and xterm's own focus brought the keyboard up.

Now, until the user taps the terminal:

  • a capture-phase focusin handler sets inputmode="none" synchronously inside xterm's focus() call, before Android decides to show the IME;
  • a MutationObserver tags the textarea as soon as it's inserted;
  • polling backs both up over the same ~6s window as applyTermThemeWhenReady.

First tap on the terminal still restores normal input and opens the keyboard. Desktop / keyboard-driven paths (focusTerm) are untouched.

Test plan

  • Android: switch channels several times (incl. a cold session) — keyboard stays down
  • Android: tap the terminal after a switch — keyboard opens on first tap, typing works
  • Desktop: channel switch still lands focus in the shell
## Summary Switching channels on a phone pops the soft keyboard again — a regression of the `inputmode="none"` fix (2411786). `suppressTermKeyboard` only re-applied `inputmode="none"` for 250ms after the iframe `load`. Since #41 we know xterm often builds its textarea well past half a second (ttyd boots, websocket reconnects), so the suppression ran out before the textarea existed and xterm's own focus brought the keyboard up. Now, until the user taps the terminal: - a capture-phase `focusin` handler sets `inputmode="none"` synchronously inside xterm's `focus()` call, before Android decides to show the IME; - a `MutationObserver` tags the textarea as soon as it's inserted; - polling backs both up over the same ~6s window as `applyTermThemeWhenReady`. First tap on the terminal still restores normal input and opens the keyboard. Desktop / keyboard-driven paths (`focusTerm`) are untouched. ## Test plan - [ ] Android: switch channels several times (incl. a cold session) — keyboard stays down - [ ] Android: tap the terminal after a switch — keyboard opens on first tap, typing works - [ ] Desktop: channel switch still lands focus in the shell
Keep the mobile keyboard down through a slow channel load
All checks were successful
CI / check (pull_request) Successful in 38s
7e65d94444
suppressTermKeyboard only re-applied inputmode=none for 250ms after the
iframe load, but xterm often builds and focuses its textarea well past
that (the ttyd bundle boots and the websocket reconnects first — see
#41). The suppression expired before the textarea existed, so every
channel switch on a phone popped the soft keyboard again.

Catch the textarea three ways until the user taps the terminal: a
capture-phase focusin handler (runs inside xterm's focus() call, before
Android shows the IME), a MutationObserver on insertion, and polling
over the same ~6s window as the theme re-assert.
pedromcaraujo deleted branch fix-mobile-keyboard-channel-switch 2026-10-15 10:14:38 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pedromcaraujo/forge!48
No description provided.