Mobile browsers are making progress with WebAssembly support and
I see more interest in handling on-screen keyboards in web games.
(typically so your game's port doesn't get the mobile player stuck with a mere "whose your name" prompt).
I explored 2 main ideas to make the virtual keyboard pop up in
SDL2 web applications in a generic way, typically on SDL_StartTextInput
(as Android SDL2 games do) but browsers don't make it easy:
At this point I'm not even sure at what layer it would be best to implement virtual keyboard support (besides re-implementing it in each application).
What's your experience with mobile webapps and keyboard support?
Hi Floh and thanks for your feedback!
This is exactly what I attempted to do, indeed it doesn't sound reliable to try and reuse the browser's keyboard.
I made tests on Android with Chromium and Firefox, and I notice a few differences:
- No security issues with offscreen text input (using top:-100px)
- No issues with triggering the focus/keyboard programmatically, e.g. from a setTimeout (iOS-specific issue?)
- In your Amstrad demo, I can't type any letter (the completion/composition system gets in the way AFAICS); I attempted to always clear the text input to compensate, but I got dup events in Firefox
More details at https://github.com/emscripten-ports/SDL2/issues/80
Arrows/Escape are a different issue, I'm not trying to emulate a full keyboard, but I'd like to support the SDL TextInput API.
Maybe just display the HTML text input and send a single input
event with the full text line when pressing Enter...
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/4c799ad0-0232-459c-8672-140cfdd9a077o%40googlegroups.com.