Skip to content

Space key not working on Android mobile keyboard #79

@coolk8

Description

@coolk8

Bug

Space key does not work on Android mobile virtual keyboard. All other characters work fine. Double-space (which triggers Android's auto-period feature) works, but single space is silently dropped.

Root Cause

In src/web/public/terminal-ui.js, the mobile input handler checks whether xterm.js already processed the input by inspecting the textarea value:

// Line ~174 in the mobile touch device input handler
const val = xtermTextarea.value;
if (!val || val.trim() === '') return;  // BUG: skips space

When the user types a space:

  1. xterm's attachCustomKeyEventHandler blocks it (keyCode === 229return false)
  2. The mobile input handler fires and checks the textarea
  3. The textarea contains " " (just a space)
  4. " ".trim() === "" → the handler thinks xterm already processed it → returns early
  5. Neither xterm nor the mobile handler sends the space → lost

Fix

if (!val || (val.trim() === '' && data !== ' ')) return;

This allows the space character through even when trim() produces an empty string.

Environment

  • Codeman v0.6.3
  • Android 14, Chrome, GBoard keyboard
  • xterm.js with attachCustomKeyEventHandler blocking keyCode === 229

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions