TextBoxes on mobile break if .Text is set while focused

If you set .Text while the user is typing, the textbox will stop working after a bit and the keyboard will just do nothing. In fact, the keyboard will stay open even if you close the Roblox app and the only way to get rid of it is to turn the phone off and on again.
This does not seem to occur on PC nor the Studio emulator.

Demo video:

Repro place (uncopylocked): Mobile Text Inputs - Roblox

Repro code:

local TextBox = script.Parent

TextBox:GetPropertyChangedSignal("Text"):Connect(function()
	TextBox.Text = TextBox.Text
end)
10 Likes

I forgot to mention use case- it’s very common to have a .Text = string.sub(Text, 1, limit) to limit how many characters a user can type into an input box, or have .Text = string.gsub(Text, "%D+", "") to ensure only numbers can be typed.

5 Likes

This bug makes it impossible to limit character counts in TextBoxes. Happens on iOS and Android devices.
It seems to be related to the autofill/autocomplete of mobile keyboards - the OS will attempt to autofill the Textbox and then the textbox breaks.

1 Like

Just assigned this to someone! We’ll get back with updates.

2 Likes

There’s another thread about this issue going all the way back to 2017, it’s been affecting mobile users for many years!

1 Like