Skip to content

fix(mobile): long-press selection blanks the terminal on Android Chrome #360

Description

@DodgyBadger

Problem

On Android 17 using the built-in Chrome browser, long-pressing terminal text does not produce a selection. The terminal instead goes blank and no Copy/Line toolbar appears.

This is a regression in the touch-selection feature added through #322.

Investigation

The custom selection starts after 350 ms and attempts to suppress Android Chrome native long-press behavior. The focused logic suites pass (81 tests), but they mock the browser and renderer rather than exercising a real Android-style touch hold.

Suspected race:

  1. Codeman begins the xterm selection.
  2. Chrome native long-press handling focuses the hidden xterm textarea.
  3. The focus guard immediately blurs it.
  4. The partial keyboard viewport animation triggers terminal resize handling.
  5. The resize path can clear the terminal before a TUI redraw, losing the selection and leaving a blank viewport.

Related concerns:

  • Scrollback touchstart deliberately does not call preventDefault, leaving native long-press behavior active.
  • The 8 px movement threshold may cancel normal finger drift too aggressively.
  • Xterm 6 themes use selectionBackground, but Codeman currently supplies the obsolete selection property, which can make the highlight invisible or inconsistent.

Expected behavior

A long press selects terminal text and reveals the Copy/Line toolbar without opening the keyboard, resizing the terminal, clearing content, or changing the scroll position.

Acceptance criteria

  • Works at both the live bottom and in scrolled-up history on Android Chrome.
  • Terminal dimensions, buffer content, and viewport anchor remain unchanged.
  • Selection and toolbar survive touchend.
  • Selection highlight uses the xterm 6 selectionBackground property.
  • Add a real Chromium mobile touch-hold regression test, including the hidden-textarea focus path.
  • Existing tap, scroll, link, and terminal-keyboard gestures remain intact.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions