Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15768] Window focus event not firing after animating containing TabGroup

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2016-10-19T14:17:41.000+0000
Affected Version/sRelease 3.1.3
Fix Version/sn/a
ComponentsiOS
LabelsSupportTeam
ReporterJannis H
AssigneeEric Merriman
Created2013-10-22T07:49:06.000+0000
Updated2017-03-21T23:15:30.000+0000

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

FileDateSize
app.js2013-10-22T07:49:07.000+00001320

Comments

  1. John Armstrong 2013-11-13

    Yes! I am having the same issues with blur event not firing anymore. It seems that the windows are always in focus and open as soon as the tab group is opened. That was not the case before. I have a videoplayer in one window and an audio player in another. They have autoplay settings that used to work fine before this new update 3.1.x. Now, both my audio and video players autoplay at the same time because both windows are opening at same time. Please fix this back to the way it used to be :)
  2. Shameer Jan 2014-09-11

    This issue exist with 3.1.3 and 3.4.0 iOS 7.1 iOS 7.0 TiSDK 3.4.0 Appcelerator Studio, build: 3.3.0.201407111535 Titanium Command-Line Interface, CLI version 3.3.0,
  3. Jason David Miller 2015-08-21

    This issue also exist with 4.0.0 + and iOS 8.4 / iPhone 5S + After animating a element, child element 'focus' and 'blur' event listeners stop working. - Is there any way to move up the priority level on this issue? I feel that many others may be limited on the types on UI/UX one can implement while using a tabbed (TabGroup) layout (which already has many iOS UI restrictions)... Thanks! ยท Jason
  4. Lee Morris 2017-03-21

    Closing ticket as duplicate with reference to the above comments and links.

JSON Source