Skip to content

Conversation

@tiann
Copy link

@tiann tiann commented Dec 25, 2025

This is a follow-up to #76, and it can now be used normally on Android.

Why it didn’t work:

  • On mobile, input often arrives via beforeinput on the hidden textarea, while the parent container only listens for keydown. This meant we added beforeinput handling, but paste and IME paths could now fire twice.
  • Paste could be emitted twice when beforeinput insertFromPaste and a paste event both fired. Worse, the textarea’s own paste handler bypassed the InputHandler’s dedupe, so duplicates still slipped through.
  • IME commit could also duplicate because compositionend and beforeinput insertText could both emit the same committed text with no suppression.

How it’s fixed:

  • Centralized paste handling inside InputHandler and attached it to both the container and textarea, so all paste flows go through the same path.
  • Added cross‑source paste de‑duplication between beforeinput and paste within a short window.
  • Added cross‑path IME de‑duplication between compositionend and beforeinput insertText.
  • Removed the textarea-level paste handler in Terminal to avoid bypassing the dedupe logic.
  • Added tests that simulate both event orders (paste before/after beforeinput, compositionend before/after beforeinput).

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