-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Emscripten: support SDL_StartTextInput and ShowScreenKeyboard #7348
Comments
The potential difficulty I see with this is that on Android and iOS it's reasonable to assume that there is a touchscreen, and therefore for But on Emscripten you cannot make any assumption about the presence of a touchscreen: if the browser is running on a mobile device there probably will be, but if it's running on a desktop or laptop device there is probably a physical keyboard. So should |
Apparently in the past this was discussed, I added some links above on the matter. Notable is RenPy approach was to reimplement it's own keyboard in their engine (B). In the Unity thread above it appears Unity managed to figure some way to use the system on-screen keyboard (A). It also appears that the method leveraged a html input text box but it also had differences between iOS and other systems.
The method with the hidden input doesn't care for this as the browser will figure out what to do here. Other methods though, will require some work there. |
Been experimenting a bit with the idea of having an input text field to type text that shows up and hides, but when the browser is fullscreen, the canvas element is selected for fullscreen, this means that the input field won't show up. Not sure what to do in this case. |
Hi, I just implemented the approach in https://github.com/PeterJensen/virtual-nascom/blob/ad344093b6df445a796ad04df035daf0b5887723/virtual-nascom.html#L211, and I want to give some observations I had when doing this.
Note that the "autocorrect text" here seems to be different from normal IME composition (or even IME composition with similar mobile keyboards, e.g. GBoard Pinyin / Handwriting). It is committed instantly, but depending on what the user chooses, it can replace the previous word with the corrected one. I am not sure if SDL's current TextInput API can handle "deleting previous word". My opinion is that approach C would be the most desirable here. Perhaps SDL can try to provide a default implementation with hints to get the hidden textarea (and disable it if this is not configured). My implementation can be found here: |
Uhm, this is because we fullscreen the canvas itself, but maybe we can use a div that contains both and fullscreen that, would it work? For this we would have to drop using the Emscripten canvas API or show this issue to upstream and get their opinion. Paging @sbc100 |
The VirtualKeyboard API might eventually be helpful, but for now it's Chromium only. |
I implemented my own version of approach A, and gave the code here: emscripten-core/emscripten#21960 (comment) |
I think that the VirtualKeyboard API is the only clean way forward on this; all the rest of these solutions look extremely fraught with danger to me. |
Looking in SDL_video I can't quite find this implemented, and it appears it doesn't work.
Apparently three ways to go here:
About A, quoting myself
From discourse: https://discourse.libsdl.org/t/emscripten-on-screen-keyboard/42576
Notable examples
Additional context
The text was updated successfully, but these errors were encountered: