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.
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 :)
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,
This issue also exist with 4.0.0 + and iOS 8.4 / iPhone 5S + After animating a
Closing ticket as duplicate with reference to the above comments and links.