Skip to content

fix: prevent double character input on Android Shift+key#65

Open
aakhter wants to merge 1 commit intoArk0N:masterfrom
aakhter:fix/android-shift-double-char
Open

fix: prevent double character input on Android Shift+key#65
aakhter wants to merge 1 commit intoArk0N:masterfrom
aakhter:fix/android-shift-double-char

Conversation

@aakhter
Copy link
Copy Markdown
Contributor

@aakhter aakhter commented Apr 12, 2026

Summary

On Android tablets, pressing Shift+A produces "AA" because the input event listener re-sends characters that xterm.js already processed via its keydown handler.

Fix

Track lastKeydownHandled timestamps on the xterm textarea. The input event handler skips if a keydown was processed within 50ms, preventing the double-send while still catching Android virtual keyboard symbols (keyCode 229) that xterm misses.

Only affects touch devices (listener gated by isTouchDevice()).

Test plan

  • On Android tablet: Shift+A produces single "A" (not "AA")
  • Virtual keyboard symbols (/, @, etc.) still work on Android
  • Desktop input unaffected (listener only active on touch devices)

On Android tablets, pressing Shift+A produces "AA" because the input
event listener re-sends characters that xterm already processed via
its keydown handler. Track keydown timestamps and skip input events
that fire within 50ms of a handled keydown.

Only affects touch devices (listener gated by isTouchDevice()).
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