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

Window focus event not firing after animating containing TabGroup

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Duplicate
    • Affects Version/s: Release 3.1.3
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:
    • Environment:

      Tried it on OSX on the simulator and iPhone 5s

      Description

      Problem Description

      The focus events for windows contained in a TabGroup stop firing after the TabGroup gets repositioned or resized (or generally animated). Tried it on 3.1.3 GA as well as the oct16 3.1.4 build.

      Steps to reproduce

      1. Create a new mobile project
      2. Paste this code to app.js:

      function Window() {
          var self = Ti.UI.createWindow({
              title:'title',
              backgroundColor:'white'
          });
           
          var button = Ti.UI.createButton({
              height:44,
              width:200,
              title: 'break events',
              top:250
          });
          self.add(button);
           
          button.addEventListener('click', function() {
              console.log("resizing");
              self.tabGroup.animate({top: 50}, function() {
                  self.tabGroup.animate({top: 0}, function() {
                      alert('focus event does not work anymore, try it');
                  });
              });
          });
           
          return self;
      };
       
      function TabGroup() {
          var self = Ti.UI.createTabGroup();
           
          var win1 = new Window(L('home')),
              win2 = new Window(L('settings'));
          win1.addEventListener('focus', function(){alert('first win focus');});
          win2.addEventListener('focus', function(){alert('second win focus');});
          win1.addEventListener('blur', function(){alert('first win blur');});
          win2.addEventListener('blur', function(){alert('second win blur');});
           
          var tab1 = Ti.UI.createTab({
              title: L('home'),
              window: win1
          });
          win1.tabGroup = self;
          win1.containingTab = tab1;
           
          var tab2 = Ti.UI.createTab({
              title: L('settings'),
              window: win2
          });
          win2.tabGroup = self;
          win2.containingTab = tab2;
           
          self.addTab(tab1);
          self.addTab(tab2);
           
          return self;
      };
       
      (function() {
          alert('switch between tabs and see the focus event');
          new TabGroup().open();
      })();
      

      3. To try it out, run attached file and switch between tabs. You'll see the blur/focus events of the windows in these tabs firing.
      4. Then tap the break events button. The TabGroup gets resized a bit and this will cause the events to break

      Expected behaviour

      TabGroup gets resized but no event is fired. Switching tabs afterwards should fire blur/focus events.

      Actual behaviour

      TabGroup gets resized and the blur event of the window in the current tab is fired. Afterwards, switching tabs does not fire blur/focus events.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                emerriman Eric Merriman
                Reporter:
                jayniz Jannis H
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration