You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Godot v4.2.2.stable - macOS 14.5.0 - Vulkan (Mobile) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)
Issue description
According to the docs for the LineEdit node, the text_changed signal is "Emitted when the text changes." I would expect that the signal would be emitted once for each letter that is typed in by the user. This works as expected when running on desktop, but does not work correctly on mobile (Tested on iOS 17.5.1).
On mobile, multiple signals are emitted with a subset of the new_text string for each letter that is typed in by the user.
The following is the output of the MRP when typing the letters "Abc" into the LineEdit text box on mobile:
In line_edit_text_changed callback
new_text: A
In line_edit_text_changed callback
new_text:
In line_edit_text_changed callback
new_text: Ab
In line_edit_text_changed callback
new_text: A
In line_edit_text_changed callback
new_text:
In line_edit_text_changed callback
new_text: Abc
The following is the correct/expected output of the same project and input on desktop:
In line_edit_text_changed callback
new_text: A
In line_edit_text_changed callback
new_text: Ab
In line_edit_text_changed callback
new_text: Abc
The main use-case that this interferes with is input validation on mobile for the LineEdit Node.
I suspect this is due to how the mobile text input system works inherently, and not necessarily a bug in the engine, if anything it'd possibly be a lack of compensation for this specific behavior, but it might just be a limitation of how phones do input due to things like autocorrect etc. (I don't have an iPhone to try on, but I wouldn't be surprised if the way text input works there is strange compared to a PC where you just have a keyboard, the same might happen with some input processing and IME etc. even on desktop)
That's how iOS (and probably Android) virtual keyboard handling currently works, it's trying to simulate key presses, so when text changes it will send the bunch of Backspace key presses and a new text as a stream of key presses.
IME works in the different way and currently edited text portion is sent via NOTIFICATION_OS_IME_UPDATE (real LineEdit text is not updated), once it's finally committed, it is sent as a stream of key presses as well, but IME will never generate Backspace.
We probably should have some sort of direct text update API and avoid key presses in both cases. In addition to unnecessary updates, there were issues on Android with text edit going out of sync with OS virtual keyboard buffer (not sure if it was fully fixed), which are also a result of current approach.
Tested versions
System information
Godot v4.2.2.stable - macOS 14.5.0 - Vulkan (Mobile) - integrated Apple M1 Pro - Apple M1 Pro (10 Threads)
Issue description
According to the docs for the LineEdit node, the
text_changed
signal is "Emitted when the text changes." I would expect that the signal would be emitted once for each letter that is typed in by the user. This works as expected when running on desktop, but does not work correctly on mobile (Tested on iOS 17.5.1).On mobile, multiple signals are emitted with a subset of the
new_text
string for each letter that is typed in by the user.The following is the output of the MRP when typing the letters "Abc" into the LineEdit text box on mobile:
The following is the correct/expected output of the same project and input on desktop:
The main use-case that this interferes with is input validation on mobile for the
LineEdit
Node.Steps to reproduce
Minimal reproduction project (MRP)
line_edit_mobile_bug.zip
The text was updated successfully, but these errors were encountered: