SDL3 SDL_SetTextInputArea() behavior differs on Android and iOS
I've noticed this when I tried to implement SDL_SetTextInputArea() in Exult and made a post at https://discourse.libsdl.org/t/sdl-settextinputarea-on-android/59971 and then decided to investigate with SDL's testime. (edit: using latest git fbba5b272)
With default testime code the textinput filed on Android stays at the same place and on iOS the rendered window shifts upward (with the settings smiley almost shifted out of the visible window). But I wasn't sure whether the Android behavior was because the textinput field was not obscured by the onscreen keyboard.
So I changed testime.c:476 in static void InitInput(WindowState *ctx) to place the textinput field much lower
ctx->textRect.x = 100.0f;
ctx->textRect.y = 200.0f;
Result: Android stays the same, onscreen keyboard obscures the textinput field. iOS the rendered window shifts way higher up, the settings smiley completely out of the window.
I find both behaviors not ideal. Android is obvious, nothing changes, the onscreen keyboard obscures the input field. On iOS you will end up assigning a different area rect than the actual input field, so you keep relevant other elements in sight (as we did for Exult).
Notes:
- when this is fixed (unless it works as expected) I'd recommend setting the input field on the lower half of the screen so, the
SDL_SetTextInputArea()is properly showcased - on iOS the settings were barely readable while on Android, very crisp.
Screenshots Android, changed code:
iOS, changed code: