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

iOS: Textfield.blur is having a strange race condition when blurring a textfield and then opening a window

    Details

    • Sprint:
      Release 3.0.0

      Description

      Problem

      If you execute blur and then open a window, looks like the blur never happened. If you run an example with Kitchensink, the blur will work as expected. It's like there is a race condition between the execution of the blur in the textfield and the open of the window, where the window opening will take precedence.

      Actual Results

      The textfield never gets the blur command, when followed by a window opening.

      Expected results

      The textfield should blur, then the window should open.

      Test case

      1. Copy this code to an app.js:

      // this sets the background color of the master UIView (when there are no windows/tab groups on it)
      Titanium.UI.setBackgroundColor('#000');
       
      // create tab group
      var tabGroup = Titanium.UI.createTabGroup();
       
      //
      // create base UI tab and root window
      //
      var win1 = Titanium.UI.createWindow({
      	title : 'Win 1',
      	backgroundColor : '#fff'
      });
      var productTF1 = Ti.UI.createTextField({
      	borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
      	top : 100,
      	width : 250,
      	height : 40,
      	hintText : "Add Product..."
      });
      productTF1.addEventListener("focus", function() {
      	Ti.API.info("focus");
      	productTF1.blur();
      	var win2 = Titanium.UI.createWindow({
      		title : 'Win 2',
      		backgroundColor : '#fff'
      	});
      	var close_bttn = Titanium.UI.createButton({
      		title : "Close",
      		top : 10
      	});
      	close_bttn.addEventListener('click', function() {
      		productTF1.blur();
      		win2.close();
      	});
      	win2.add(close_bttn);
      	var data = [];
      	var tableView = Ti.UI.createTableView({
      		data : data,
      		top : 100
      	});
      	win2.add(tableView);
      	tab1.open(win2);
      });
      win1.add(productTF1);
       
      var tab1 = Titanium.UI.createTab({
      	icon : 'KS_nav_views.png',
      	title : 'Tab 1',
      	window : win1
      });
      tabGroup.addTab(tab1);
       
      // open tab group
      tabGroup.open();
      

      2. Now run the code with 2.1.3.GA on iOS 4.x.
      3. If you click on the textfield, the window will open. Close the window, the textfield shouldn't be focused.

      Extra info.

      This is a regression. This used to work just fine with TiSDK 2.1.3.v20120915120319, now with 2.1.3.GA is broken.

        Attachments

          Activity

            People

            • Assignee:
              vduggal Vishal Duggal (Inactive)
              Reporter:
              mpmiranda Mauro Parra-Miranda
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

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

                  Git Integration