Skip to content

Limited touch support on mobile devices impacts terminal usability #5377

@friuns2

Description

@friuns2

Describe the bug

The terminal has limited support for touch interactions on mobile devices and touch screens. This severely impacts usability on mobile devices as users cannot effectively interact with the terminal using touch gestures and mobile-specific input methods.

To Reproduce

  1. Open xterm.js terminal on a mobile device or touch screen
  2. Try to interact with the terminal using:
    • Touch gestures for scrolling
    • Pinch-to-zoom
    • Touch selection of text
    • Long press for context menu
    • Double tap for word selection
  3. Note that these interactions either don't work or fall back to basic mouse event translation

Expected behavior

The terminal should provide comprehensive touch support with:

  1. Native touch event handling instead of mouse event translation
  2. Support for common touch gestures:
    • Single tap for cursor positioning
    • Double tap for word selection
    • Long press for context menu
    • Two-finger pinch for zoom
    • Two-finger scroll for terminal scrolling
  3. Touch-optimized text selection with:
    • Selection handles
    • Magnifying glass for precise cursor positioning
    • Mobile-friendly context menu
  4. Proper integration with virtual keyboards and mobile keyboard accessories

Current behavior

  • Touch interactions are limited or non-functional
  • Mobile experience relies on browser's mouse event translation
  • No native touch gesture support
  • Text selection is difficult on touch devices
  • Virtual keyboard integration is basic
  • No mobile-optimized interface elements

Screenshots

No screenshots available - this is a feature limitation report

Environment

  • OS: iOS 16+, Android 12+
  • Browser: Safari iOS, Chrome Android, Firefox Android
  • Device type: Mobile phones, tablets, touch-enabled laptops
  • xterm.js version: Latest

Additional context

This affects all mobile and touch-enabled devices. Current implementation in CoreBrowserTerminal.ts focuses primarily on mouse and keyboard events, with no dedicated touch event handling.

Proposed Solution

  1. Implement TouchHandlingService for native touch event processing
  2. Add touch-specific configuration options to ITerminalOptions
  3. Enhance CoreBrowserTerminal with touch event bindings
  4. Add mobile-optimized UI elements for selection and interaction
  5. Improve virtual keyboard integration

See technical implementation details in the previous description for complete solution architecture.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions