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

Android: auto-focuses and shows keyboard for first textfield on Samsung Galaxy Tab on window open or textfield create after window open

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Duplicate
    • Affects Version/s: Release 2.0.0, Release 1.8.1
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
    • Environment:

      Samsung Galaxy Tab
      android 3.2
      Ti SDK 2.0.x

      Description

      On a Samsung Galaxy Tab running Android 3.2, if you have a textfield in your window, it will auto set focus to it when either the window is opened or when you create the textfield after the window is opened. This is OK for some situations, such as when you have a form and want it to set focus to the first element by default. However, in other cases, such as when you have a TextField hiding off of the screen and then slide it into view when the user presses a button, it becomes an issue as the keyboard slides up for no reason. Note that it does not set focus to the textfield within the Android emulator.

      Here is code to reproduce, which creates the textfield after opening the window.

       
      var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
      win.addEventListener("open", function() {
      	var text = Ti.UI.createTextField({ width: 200, height: 60, top: 20, enabled: false, borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED });
      	win.add(text);
      });
      win.open();
      

      And more code, which shows the same behavior when creating the textfield and then opening the window.

       
      var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
      var text = Ti.UI.createTextField({ width: 200, height: 60, top: 20, enabled: false, borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED });
      win.add(text);
      win.open();
      

      Even setting the textfield to enabled: false, it still auto focuses it. At the very least, there should be a property that you can set that will prevent it from auto focusing the textfield. Ideally it should not auto focus the textfield, that way you have the option of focusing it with the textfield.focus(); method yourself.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                jtoth Justin Toth
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration