Fix iOS multiline TextArea NON_PREDICTIVE constraint ignored causing cursor misplacement #3946
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
On iOS 18+, the
TextArea.NON_PREDICTIVEflag was completely ignored for multiline TextArea components, causing predictive text and inline suggestions to appear even when explicitly disabled. This led to cursor misplacement issues when iOS's "Show Predictions Inline" feature was enabled, making multiline text input frustrating and unreliable.The issue only affected multiline TextArea components - single-line TextField components worked correctly.
Root Cause
The iOS native implementation in
CodenameOne_GLViewController.monly applied text input constraints (includingNON_PREDICTIVE) to single-line text fields (CN1UITextField). The multiline text view code path (CN1UITextView) completely lacked constraint handling, causing all flags likeNON_PREDICTIVE,INITIAL_CAPS_WORD, etc. to be ignored.Solution
Added comprehensive constraint handling to the multiline text view creation in
Java_com_codename1_impl_ios_IOSImplementation_editStringAtImpl:autocorrectionType = UITextAutocorrectionTypeNoto disable predictive textINITIAL_CAPS_WORD,INITIAL_CAPS_SENTENCE,UPPERCASEPASSWORD,USERNAMEwith propertextContentTypeEMAILADDR,NUMERIC,PHONENUMBER,URL,DECIMALThe implementation mirrors the existing single-line constraint logic, ensuring consistent behavior across both text input types.
Testing
The fix resolves the exact scenario described in the bug report:
Impact
Closes the issue where multiline TextArea components ignored the NON_PREDICTIVE flag, causing poor user experience on modern iOS devices.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.