xtermjs / xterm.js

A terminal for the web
https://xtermjs.org/
MIT License
17.44k stars 1.62k forks source link

Copy and paste do not work on touch devices #3727

Open williamstein opened 2 years ago

williamstein commented 2 years ago

Details

Steps to reproduce

  1. Go to the demo at https://xtermjs.org
  2. The terminal works. However, it is not possible to select text at all by touching the screen, so copy (and paste) are impossible.
  3. Using a keyboard and trackpad on the iPad, you can select text, but when you copy with (cmd+c), it does NOT copy, leaving the clipboard unchanged. Paste does work with a keyboard.
  4. I also tried both the canvas and dom, and the webgl addon. I couldn't select text with any of those.

I use xtermjs, in https://cocalc.com for desktop, but for mobile I've been using an ancient version of term.js... almost entirely because copy paste actually always fully worked with term.js on ipad.

williamstein commented 2 years ago

Minor correction: paste never worked in the ancient term.js; however, copy does.

Tyriar commented 2 years ago

Copy and paste may work with the DOM renderer (and/or screen reader mode) on iPad, pretty sure this isn't possible with canvas/webgl until we get better APIs from the browser though.

williamstein commented 2 years ago

Copy and paste may work with the DOM renderer (and/or screen reader mode) on iPad

Thanks, but unfortunately, it doesn't yet. As it used to with the term.js DOM renderer, I'm optimistic it's possible. Honestly, I'm very surprised it doesn't work already, and hope it's just a matter of some small CSS/Javascript tweak to fix this. I'm definitely fine with DOM-only for iPad/iOS. I'll likely dive into fixing this bug myself and contributing the fix, as soon as I get time.

andy380743909 commented 9 months ago

The latest version 5.3.0, I set the rendererType to 'dom' with this code term.options.rendererType = 'dom';, but the selection function still not work on my iPhone.

williamstein commented 9 months ago

The latest version 5.3.0, I set the rendererType to 'dom' with this code term.options.rendererType = 'dom';, but the selection function still not work on my iPhone.

Thanks for testing. I'm still stuck shipping the ancient term.js that xterm.js was based on, because of this. I've never been able to figure out how to get this to work on mobile with dom rendering either. It can't be hard... but how?

jerch commented 9 months ago

It can't be hard...

Yeah, it prolly isn't (although the event model on a touch device differs alot).

Our whole testing is very desktop-centered, so for mobile devices we def. have a blind spot. Not only for iOS devices, we also see a lot of issues on Android around key input and touch navigation.

Unless a white knight with strong touch device dedication shows up, this is unlikely to change soon. So any help in that field is more than welcome.

williamstein commented 9 months ago

Thanks for the encouragement; I will try again when I get a chance. Please don't close this issue as wontfix, since maybe I'll fix it. It definitely matters to me a lot, and I would love to not also ship term.js. I definitely don't want to solve all the touch navigation and input issues -- I just want to make copy possible. On cocalc I have other solutions to navigation issues, e.g., there are buttons across the top for standard things like tab that you need in a terminal, and there is also a normal text area that one type into instead at the top, and then submit the input. But not being able to copy from the rendered output is a real dealbreaker in terms of usability.

ValerioB88 commented 3 months ago

I confirm it doesn't work on android either (tested on the xterm on xtermjs.org). Would love to have this fixed :)