Abnormal TextBox.MultiLine behavior on mobile devices

,

Greetings,

I have a TextBox with TextBox.MultiLine set to true in order to support multi-line strings. The TextBox possess the normal multiline behavior on desktop devices and correctly skips a line upon pressing Enter/Return. Although on mobile devices (tested on iPhone 15 Plus), it entirely loses focus and behaves as if the MultiLine property was disabled.

Below is the explorer hierarchy of the UIObjects where Notes is the problematic TextBox in question. The TextBox has RichText disabled and TextWrapped enabled:
image

To further test workarounds, I put together this little code below to check if the Return key on iPhone keyboard is correctly detected and if so, forcefully return focus back on the TextBox if pressed:

Notes.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		task.wait()
		Notes:CaptureFocus()
		print("Return pressed.")
	end
end)

This returned with no luck and in-fact unusual behavior (when tested on a mobile device) since "Return pressed." is printed without the focus returning to the TextBox at all. Generally, enterPressed shouldn’t return true in TextBoxes with MultiLine enabled as focus is never lost by pressing Enter/Return.
Behaved absolutely normal and perfectly fine on a desktop device with the TextBox never losing focus, hence, never firing FocusLost upon pressing Enter.

Hence, I’m looking for some advice on what exactly is it that I’m doing wrong here. Is it something with my other properties or the UI hierarchy that is overriding the MultiLine behavior, or is it that MultiLine was never made compatible to work with mobile devices?

Any help is greatly appreciated. Cheers.

1 Like