Skip to content

Touch-device duplicate guard drops repeated hardware keys (iPad key repeat, fast double letters) #1886

Closed

Description

@waleedkadous

Problem (found by reading the code, not yet reproduced on a device)

On a touch device, the dashboard terminal's exact-duplicate guard from #517 (late soft-keyboard duplicates) is always on. It drops any onData payload equal to the previous one within 150 ms (apps/web/src/components/Terminal.tsx):

if (!fromIme && (inCompositionWindow || isTouchDevice) &&
    data === lastSentData && now - lastSentTime < 150) {
  return;
}

isTouchDevice is (pointer: coarse), which matches an iPad even with a hardware keyboard attached. Hardware keys go through xterm's keydown path, so they reach this guard as separate, identical onData payloads:

  • Key repeat: holding Backspace, an arrow key or a letter repeats every ~30–50 ms, so most repeats would be dropped. A held ↓ in a TUI menu, or a held Backspace, would move or delete a fraction of what the user expects.
  • Fast double letters: ll in hello, or \r\r, typed within 150 ms. The second key is dropped.

Soft-keyboard text is no longer affected: since PR #1884 (the fix for issue #1883, mobile autocomplete duplicating text), the IME bridge sends soft-keyboard edits itself, and they bypass this guard. What still reaches the guard on a touch device is hardware keys, paste, the sticky modifiers, and xterm's terminal replies.

To decide

  • Reproduce on an iPad with a hardware keyboard: hold Backspace in a shell line, and type hello quickly.
  • Then decide whether the guard is still needed on touch devices at all, now that soft-keyboard text bypasses it. The duplicates Mobile: duplicate letters and extra periods when typing #517 targeted came from xterm's textarea handlers on soft-keyboard input, which the IME bridge now keeps xterm from seeing. If it is no longer needed, scoping it back to the composition window (inCompositionWindow) alone is the likely fix.

Found while working on PR #1884; out of scope there.

Activity

  1. added
    area/terminal
    on Nov 9, 2026
  2. added 2 commits that reference this issue on Nov 9, 2026
  3. added a commit that references this issue on Nov 9, 2026
  4. added a commit that references this issue on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/terminal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions