Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19877

Android: Cannot tap to select text in TextArea with "editable" set to false like iOS

    Details

    • Sprint:
      2016 Sprint 11 SDK, 2018 Sprint 16 SDK, 2016 Sprint 17 SDK, 2018 Sprint 18 SDK, 2018 Sprint 19 SDK, 2018 Sprint 20 SDK, 2018 Sprint 21, 2018 Sprint 22

      Description

      Summary:
      While a 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:

      1. Build and run the below code on Android.
      2. Tap and hold on a word in the TextArea.
      3. 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

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              narenderreddich narender
            • Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20604
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Source Code