-
-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
You can't type characters on android #39
Comments
When you type characters they are append to adress bar, that's why screen keyboard is visible focus is in adress bar. |
You can type characters using hardware keyboard but not virtual one. |
I believe this is the same issue as the one that was resolved here: I tested this using the Chrome browser on Android and found that numbers 0 to 9 and ENTER worked, but other characters did not. |
I've just read on wikipedia article that WebShell use it's own keyboard for touch devices. I need to look into that. This will also fix #36 |
I almost fixed the issue, demo here: http://terminal.jcubic.pl/android.html I map terminal cursor to textarea (reusing clipboard) but on Android it act weird (work fine on desktop). |
I think I've fixed the issue in devel branch. |
That demo does not fix it for me. Running latest stable chrome on 4.4.3 |
Did you tap on terminal? There is no way to open virtual keyboard onLoad, only native events can trigger keyboard to popup. I can only test on 2.3.3 and you can't isntall google chrome on it (I've tested on builtin webkit browser) |
Tested this on Android 4.4.2 using the built in browser and Chrome, did not work for either.
|
I'm using hacker keyboard, will try with builtin one. |
when I press enter I get this error |
@mitchelldmcmillan sorry about that, I've changed the API and old api throw exception. But did you was able to type something? |
No, nothing showed up, just an error when I pressed space |
A little update, I tried again and there are no more errors, but still nothing shows up. Also tried in Firefox, nothing as well. |
+1 Any fix for this issue yet? I use jquery.terminal in quite a few projects and it woud be nice to have it work just as well on mobile devices :) |
I'd also like to put in my +1 for this issue. I've tried the terminal on 2 different Android devices and the problem persists for both. It'd be great if this worked :) |
+1 I tried using it on WP8 and no results |
I've updated the demo to lastest css and js. And it work on my phone (Andorid 2.3) but enter don't work on different phone I've tested. I've also tested on browserstack on two phones and it work. |
Fixed enter on that one phone. |
Nothing shows up as you type, when you press enter it says "you said: ". I think it must be an issue with autosuggestion, as the words show up in the bar above my keyboard as well as suggestions. Also just a change I am now testing on CyanogenMod nightly, still Android 4.4.4 and latest stable Chrome. |
can you test again and tell me what get echo while you typing? |
When I press the enter key, I get: you enter : All other key presses display: keydown else |
It look like keypress don't work at all, weird. |
All I am getting when I press enter is "you enter:" |
Use android.php file - it use |
Now I am getting what Keith described. |
Sorry, I didn't have the time recently to work with the plugin. also it's realy hard to work when my Android (htc desire Z with A 2.3) work fine. Recently I was testing MacOS when I borrow macbook from my friend for a moment but those fixes are not in the repo yet. |
I did some more testing, in Chrome on Android 4.4.4 The key_down(e) function is triggered when you press a key, e.which and e.keyCode will give the correct value for the key pressed. However, the character is not displayed in the terminal prompt. I will do some more testing, but I believe to fix this, android must be detected and the character injected to the command prompt. |
Summary: key events across Android browsers are inconsistent, implemented incorrectly, and buggy. Links related to what is causing this issue: I "fixed" this issue on the latest version of Chrome for Android by caching e.which in the key_down function, and then adding a listener for the compositionupdate event. (-) $(document.documentElement || window).bind('keypress.cmd', function(e) { (+) $(document.documentElement || window).bind('compositionupdate', function(e){if(!lastkey.bad) keystrokes(lastkey);}); (+) lastkey = {which: e.which + (e.shiftKey ? 0 : 32), ctrlKey: e.ctrlKey, bad: e.which == 0}; The 'keypress' event will send the character that is pressed, while the 'keydown' event only sends the key pressed, so you have to check to see if shift is pressed in order to determine upper/lower case, etc. This is because the keypress event does not trigger on Android Chrome when a composition is being done, although it will trigger on non-compositions, like pressing '1' or 'ENTER'. Also, there is apparently a bug, in that when a composition completes (by pressing enter for example) when the next composition starts and the next keydown event will send the value of 0 for e.which (but will still trigger all the events). This is all great, except that this code does not work on the built in "Internet" browser app that comes with Android 4.4.4 or with Firefox on Android. All 3 browsers seem to handle compositions differently, and send different events in different orders, so here's what happens when the following sequence of keys is pressed. Sequence: abc(ENTER)abc(ENTER) (kd) = keydown event Windows Firefox:
Android Chrome:
Android Firefox
Android Internet (default browser)
Android Internet (default browser) seems to be based on an older version of Chrome, it's very similar except for a minor different in events when a compositionend happens. However, after the first composition it will start sending garbage keys. Android Firefox seems to do something different (and better) than Chrome, since it actually does a composition and when the compositionend occurs it triggers the (keypress) events from the composition in sequence, this would make Firefox work nicely without any changes necessary, except that it will sometimes store all the keys pressed for the session and injects them into a composition. So you will get every command character you typed flooding into the terminal. The composition events seem to have no information on the keys being pressed, or inconsistent data between the browsers, so you can only get the key from e.which in keydown events semi-reliably. Perhaps there is some clever way to do this differently by binding an 'input' event handler, but I don't really see how to make a generic solution that works on all Android browsers due to buggy inconsistent implementation, especially with Chrome. I gave up on solving the problem in this way, and solved the problem using an field instead, which I will detail a following post. |
Here's my solution to the problem: KeithTurkowski@2313244#diff-dba734ca44649c50a5de68bf61511841 I use an field to capture the input instead of capturing keypress, it probably isn't fully functional for all the features of jquery.terminal, but it does solve the problem for my purposes. Unfortunately, the way these events are handled on different browsers on Android is so terrible, I don't think a key event solution is really feasible. |
Also, if you want to incorporate this code, I think the following line of code is poorly placed:
I hacked it in without fully understanding the purpose of the code around it. |
Thanks for this, Keith. I have been experiencing the exact same problem, thanks perhaps to your solution the "Internet" and "Chrome" apps work fine for me on Android. My current issue surrounds the "Google Keyboard" app. The only keystrokes that register are numerals, despite using your updated solution. Any ideas? |
When you create your terminal, are you using "altinput: true" in the settings? It should work since it's using an <input> element. |
Hi Keith. Good point. I've added that in (not sure if in the right place?). Could you take a look for me here if you have a spare couple minutes ... can anyone see what I've done wrong? Hope it is an obvious fix. http://chaostheorem.com/android |
You need to pass it as an option to second argument. |
Oh my! THANK YOU |
Does anyone else have this same problem? http://chaostheorem.com/android is not compatible with IE11. The enter/return key on the keyboard isn't recognised. Instead, a mouse click event is required? No way to have the script work for both mobiles and desktops? |
I do something like: altinput: is_android() Find a library that detects android / mobile. |
Didn't think of that. Thanks. For anyone else stuck, use this: var ua = navigator.userAgent.toLowerCase(); altinput: isandroid //second argument |
Was there a solution to this issue? I'm using an older embedded chrome browser and cannot type anything in jquery terminal. when running: http://terminal.jcubic.pl/test.php i get: keydown I see in my user agent string AppleWebKit/533.19.4 = so it is pretty old but unfortunately I'm stuck with it and I really want to use the jQuery Terminal in there as well! a solution will be greatly appreciated. |
Right now you can try to use KeithTurkowski fork. You will need to use option |
works indeed! thanks!! Any chance to implement this on the main branch as well? |
Yes I will implement this in main branch, I want it for 0.9.0 version. |
Finally added Keith Turkowski solution with input event to devel branch, I didn't add change event though. |
still not fix on mine. you can try it out here https://biol.be/qrpoc |
I can't open that link on my android phone (2.3.3 with default browser), I've got error that the browser can't establish secure connection but it work on my laptop. |
@jcubic waw, you have old phone 😃 . |
ohh and I remember 1 more thing. |
try to disable terminal on init using option: |
I've copied your code to my server and testing, don't know yet why your code is not working it work here: http://terminal.jcubic.pl/android.html |
Fixed in version 0.11.12 |
@jcubic big thanks, it works 😸 . |
I think this issue can be closed then. |
When you enter a site with fullscreen terminal on android the keyboard is popup but you can't enter characters
Fixing this bug will probably fix issue on iPhone and iPad.
The text was updated successfully, but these errors were encountered: