[TIMOB-19877] Android: Cannot tap to select text in TextArea with "editable" set to false like iOS
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Reopened |
Resolution | Unresolved |
Affected Version/s | Release 5.0.2, Release 8.0.2 |
Fix Version/s | n/a |
Components | Android |
Labels | TextArea, TextField, editable, engSchedule, parity, selectable |
Reporter | narender |
Assignee | Unknown |
Created | 2015-10-15T10:15:54.000+0000 |
Updated | 2019-10-28T05:14:54.000+0000 |
Description
*Summary:*
While a Tap and hold on a word in the
TextArea
object's property "editable" is set to false
, end-users cannot tap to select text like how it works on iOS. This is a parity issue.
Note that the TextArea
is not disabled. The end-user can scroll the content. The issue is that no cursor is shown and it's impossible for the end-user to make cursor selections. (However, the setSelection()
method works and text selections can be made programmatically.)
*Steps to reproduce:*
Build and run the below code on Android.
Tap and hold on a word in the TextArea
.
Notice that no selection was made. _(This is the issue.)_
var window = Ti.UI.createWindow();
var textArea = Ti.UI.createTextArea({
value: "Line 1\nLine 2\nLine 3\nLine 4\nLine 5\nLine 6\nLine 7\nLine 8",
editable: false,
suppressReturn: false,
left: "20dp",
right: "20dp",
height: "100dp",
});
window.add(textArea);
window.open();
*Note:*
On iOS, if TextField
property "editable" is set false
, then the end-user is unable to tap to select text either. So, in this case, both Android and iOS are in parity. I think this is the "native" iOS behavior, although it is inconsistent with iOS' own TextArea
behavior.
*Cause:*
Titanium is calling setCursorVisible(false)
in the Java TiUIText.handleKeyboard()
method below.
[TiUIText.java#L650](https://github.com/appcelerator/titanium_mobile/blob/3b75bf2b9f9733bca93ad22d738fea0525da9431/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIText.java#L650)
But since iOS' TextField
does not allow text selection while "editable" is false
, Android should continue to call setCursorVisible(false)
only for the single-line TextField
case.
is the bug resolved ? or any other solution to select text?
Is any other Alternative solution for select text in Lable/TextArea? please suggest any solution.
This is because you set:
On Android, this will disable the Text Area, and you won't be able to select anything. Behavior may be different on iOS.
"Won't Fix" ??? Can you explain why? I think 'editable' is different from 'disable'.
Not much help to get here I guess? Is there no way to be able to copy a small textarea or label?
It seems this is potentially related to a known Android system issue and the SO article proposes a work-around. Perhaps that can be added to Titanium? [https://stackoverflow.com/questions/37566303/edittext-giving-error-textview-does-not-support-text-selection-selection-canc/38626276#38626276] [https://code.google.com/p/android/issues/detail?id=208169] I am encountering the same issue on 5.5.1 when I long-press on rows in a table. When I roll-back to 5.2.0, the issue goes away.
Checking on this one
Its strange that this issue is pending since 2015. There must be some solution as text based applications are useless without this feature.