Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7820] iOS: Events - Focus event is fired multiple times during initial launch of app

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-07-05T03:48:21.000+0000
Affected Version/sRelease 1.8.1, Release 1.8.2
Fix Version/sRelease 2.0.0, Sprint 2012-06
ComponentsiOS
Labelsmodule_tabgroup, parity, qe-ios021312, qe-testadded
ReporterWilson Luu
AssigneeStephen Tramer
Created2012-02-27T10:37:23.000+0000
Updated2012-07-05T03:48:21.000+0000

Description

Steps to reproduce: 1. Run following code:
var tabGroup = Ti.UI.createTabGroup();

var win1 = Ti.UI.createWindow({
	name: "win 1"
});
var tab1 = Ti.UI.createTab({
	name: "Tab 1",
	title:'Tab 1',
	window:win1
});

var win2 = Ti.UI.createWindow({
	name: "win 2",
	title:'Tab 2',
	backgroundColor:'#fff'
});
var tab2 = Ti.UI.createTab({
	name: "Tab 2",
	title:'Tab 2',
	window:win2
});

tabGroup.addTab(tab1);
tabGroup.addTab(tab2);

tabGroup.addEventListener('focus', function(e){
	Ti.API.info('-------------> tabGroup focus event fired! - ' + e.source.name);
});
tab1.addEventListener('focus', function(e){
	Ti.API.info('-------------> tab1 focus event fired! - ' + e.source.name);
});
tab2.addEventListener('focus', function(e){
	Ti.API.info('-------------> tab2 focus event fired! - ' + e.source.name);
});
win1.addEventListener('focus', function(e){
	Ti.API.info('-------------> win1 focus event fired! - ' + e.source.name);
});
win2.addEventListener('focus', function(e){
	Ti.API.info('-------------> win2 focus event fired! - ' + e.source.name);
});

tab1.addEventListener('blur', function(e){
	Ti.API.info('**************> tab1 blur event fired! - ' + e.source.name);
});
tab2.addEventListener('blur', function(e){
	Ti.API.info('**************> tab2 blur event fired! - ' + e.source.name);
});
win1.addEventListener('blur', function(e){
	Ti.API.info('**************> win1 blur event fired! - ' + e.source.name);
});
win2.addEventListener('blur', function(e){
	Ti.API.info('**************> win2 blur event fired! - ' + e.source.name);
});

tabGroup.open();
Actual: After initial launch of code, focus event is fired 3 times for tabGroup and 2 times for tab:
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tab1 focus event fired! - Tab 1
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tab1 focus event fired! - Tab 1
Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> win1 focus event fired! - win 1
Expected: Focus event should be fired once similarly when running code on Android:
I/TiAPI   ( 1770): -------------> tab1 focus event fired! - Tab 1
I/TiAPI   ( 1770): -------------> tabGroup focus event fired! - Tab 1
I/TiAPI   ( 1770): -------------> win1 focus event fired! - win 1
Note: Bug still occurs in 1.8.1

Comments

  1. Stephen Tramer 2012-03-12

    Please note that the following is not a bug on iOS (as far as the ticket is concerned):
       Feb 27 10:26:42 unknown UIKitApplication:com.monkey.test[0x2b31][16642] <Notice>: [INFO] -------------> tabGroup focus event fired! - undefined
       
    This is because the source checks for e.source.name, and the source of the tabgroup "focus" event is the tabgroup itself (not the tab). This is a separate parity issue to resolve.
  2. Satyam Sekhri 2012-03-16

    Closing bug. Verified fix on: SDK build: 2.0.0.v20120316093247 Titanium Studio, build: 2.0.0.201203152033 Device: iPhone4s (V5.0.1)
  3. Neha Chhabra 2012-07-05

    Reopening to update labels.

JSON Source