-
Notifications
You must be signed in to change notification settings - Fork 33
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
Android soft keyboard stuck in show/hide loop whenever text input is possible #32
Comments
This has been noted before (see also erkyrath/glkote#7 , erkyrath/glkote#25 ). I would love some help on figuring out what to do about it. I do not have Android devices to test on. |
Android Studio provides an excellent emulator, if you'e interested in debugging, yourself. I will try to look into it myself, as time permits. |
I'm looking into the issue today with the intention of finding the problem code. Posting here to coordinate efforts / duplicate attempts. |
I got it set up for debugging, but haven't had time to start, yet. Will probably have time this weekend if you haven't found it yet. FWIW I was going to start by investigating all the focus and blur code in glkote.js |
Ok, thank you. I posted a discussion topic specific to the issue and test case of City of Secrets: http://www.intfiction.org/forum/viewtopic.php?f=38&t=22938 |
I think the problem is more fundamental than just focus issues. A normal Chrome web page that you use, like the one we are currently reading on GitHub - doesn't get re-scaled and re-sized just because the keyboard pops up. Normally a vertical scroll bar is there to account for the vertical space, like you scrolled the page up or down - the page content isn't changing at all when the Android soft keyboard appears and disappears. On a 10" tablet, if the keyboard is off, the Purple/Yellow/White opening image of City of Secrets is nearly the full screen height on Android Chrome. However, when I activate the keyboard - instead of a vertical scroll bar appearing - it reacts by doing a major repaint / redraw / graphics scale of the entire screen to now where the Purple/Yellow opening image of City of Secrets is only about 4" of my 10" Android tablet. No interaction with Glulx is taking place here, the VM is still waiting on the Glk char INPUT for the "PRESS ANY KEY TO BEGIN" prompt. The story Dead Cities by John Ingold demonstrates this resize issue even more, and it won't allow me to type at all into the main Glk TextBuffer window because it insists on resizing the Glk windows every time the keyboard pops up/disappears. Also note that with a hard keyboard: USB, Bluetooth, or the emualtor one - this problem goes away - as GlkOte isn't thinking the window resized each time the keyboard is unplugged and re-plugged (imagine a USB keyboard you remove and insert, that's kind of what the soft keyboard is doing when you hide and show it). |
You wrote at the intfiction.org forum:
I think Note also that the Do you remember @erkyrath why it needs to be absolutely positioned? Is it to do with character/key input? If so I would recommend that we completely separate the two keyboard input types in code. I think we need to completely redo key input with more modern events. (What those are I'm not sure yet.) Seeing as char input doesn't work in Mobile Chrome anyway it would be safe to test whether commenting those lines out fixes this issue. In char input the |
It could be what we are seeing is this:
|
Yep, it's in a race condition, question is why. My guess is the |
The input line is absolutely positioned, I think, because I didn't want the page size to change when the The absolute positioning is used regardless of whether we're waiting for line or character input. There's no difference in how the DOM is set up for the two events, except that it's legal to print stuff during character input. (That's what line 1113 is for.)
If stuff has been printed, then the |
Right, but text can only be added for character input, and for char input the In order to fix the character input for mobile browsers I think we'll need to switch to the |
Am I right in thinking that in the CoS case, the game is accepting character input repeatedly without printing to the same window? I think covering that would handle a large chunk of the real-world problem. |
@erkyrath - tracing it with RemGlk, I only see one generation that is waiting for a "press any key" prompt. In contrast, same author has a nearly identical layout at the opening of the story Best of Three: http://ifdb.tads.org/viewgame?id=t1egxcvjz5pcm0xq - and it does a hyperfast Glk timer to do the same prompt. I can see it on Quixe on my desktop Chrome blinking the cursor at ludicrous speed. |
The problem is present with line input too. That's the main thing which needs fixing. |
This fixes to a large extent the rapid race condition flashing of the keyboard reported in erkyrath/quixe#32
I've submitted a pull request which fixes the show/hide loop in CoS. If we can get that merged (and then into Quixe) we can see what other issues remain. |
Confirm @curiousdannii fix works on my testing. When I touch to retract the keyboard it no longer reopens by itself. Thank you. |
I need some help, confirmation: it seems I might have overlooked a more serious problem that is happening with City of Secrets on Android with this opening screen; Chrome browser / Android 7 (LG tablet, and Google emulator). Does the soft keyboard even work on the "PRESS ANY KEY TO BEGIN" prompt? I've been mostly testing with both soft and hard keyboard at the same time - and I actually tried the soft keyboard spacebar. Android gives audio feedback at the soft key press, and I see the HTML input field advances one space - but the story itself does not continue! Soft keyboard backspace even seems to work, removing the space added after "BEGIN". Pressing USB/Bluetooth/Emulator hard keyboard spacebar works fine. This is with or without @curiousdannii fix from 14 hours ago. |
It would probably be best to post that as a separate issue. |
I am outright begging someone takes the time to confirm the issue. As I said 6 days ago: "I need some help, confirmation" - it was a plea for HELP! |
executive summary: show/hide loop is gone. I can confirm, that the "endless open-close-keyboard loop" is gone after applying that patch. |
This fixes to a large extent the rapid race condition flashing of the keyboard reported in erkyrath/quixe#32
This fixes to a large extent the rapid race condition flashing of the keyboard reported in erkyrath/quixe#32
For example: in City of Secrets, the keyboard will constantly show hide during the title screen and first room, but when you go north and are presented with two clickable options instead of text input, the keyboard remains hidden. This makes games near impossible to play.
My guess is that there's some JavaScript changing the cursor position, which focuses the input, and triggers a keyboard show event. Then it loses focus somehow and triggers a keyboard hide event. This guess is based on Android Studio debug logs like these:
08-06 12:43:29.631 1605-1605/? I/LatinIME: Starting input. Cursor position = -1,-1
08-06 12:43:29.667 1605-1605/? I/LatinIME: Starting input. Cursor position = 0,0
The text was updated successfully, but these errors were encountered: