Pressing Backspace on empty TextBox on Android device breaks available input detection

In my experience, I use this function to handle some features appropriately depending on what inputs the user has available:

function MobileController.IsOnMobile()
    return UserInputService.TouchEnabled and (not UserInputService.KeyboardEnabled) and (not UserInputService.MouseEnabled)
end

I understand there’s no actual way of detecting the device or OS of a user, but this function is necessary for prompting the user for the appropriate input for some of our systems. For example, you wouldn’t want to ask a user to click their mouse if UserInputService.MouseEnabled is false.

The problem comes from KeyboardEnabled and MouseEnabled being turned on when an Android user presses Backspace on an empty TextBox, for example the chatbox. The video below demonstrates this happening. Note how KeyboardEnabled and MouseEnabled are false before the bug is reproduced, and how there are PERMANENTLY enabled after closing the keyboard. This only happens when you press backspace on an empty TextBox on an Android device.

Reproduction file:
AndroidBugRepro.rbxl (56.4 KB)
This RBXL features a TextLabel in the middle of the screen that displays the statuses of TouchEnabled, KeyboardEnabled, and MouseEnabled. When pressing Backspace on an empty TextBox on a mobile Android device, you will see that KeyboardEnabled and MouseEnabled turn on.

Expected behavior

On iOS this enabling of KeyboardEnabled and MouseEnabled does not happen when you press backspace on an empty TextBox. This is the intended behavior. The user should not suddenly have a mouse or keyboard plugged in by pressing Backspace in an empty TextBox (and it doesn’t get disabled after typing either).

3 Likes

This is also breaking mobile detection in a game I’ve worked on with similar behaviour.

2 Likes

You shouldn’t be detecting input types by the available input types, and instead dynamically updating to the last used input type. See this: Cross-Platform Design | Documentation - Roblox Creator Hub

Thanks for the report! We’ll investigate and follow up with updates.

pressing backspace would mess this up too if it detects backspace as a keyboard input

It would resolve if you touched the screen again though, as you’re using the touchscreen making it the last used input type