Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9811] Android:Tabgroup:Focus event for a tab is showing wrong source name.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-06-27T15:11:43.000+0000
Affected Version/sRelease 2.1.0
Fix Version/sRelease 2.1.0, Sprint 2012-13 API, Release 3.0.0
ComponentsAndroid
Labelsapi, module_tabgroup, qe-and060112, qe-testadded, regression
ReporterShyam Bhadauria
AssigneeJosh Roesslein
Created2012-06-27T00:28:25.000+0000
Updated2013-12-10T05:57:12.000+0000

Description

This is a regression.It works fine with 2.0.2. Focus event fired for tab 1 is giving 'e.source.name=tab 2' Please find logs attached for 2.0.2 and 2.1.0. Steps to reproduce 1) Use the code below
var tabGroup = Ti.UI.createTabGroup({
	name:"tabgroup"
});

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();
2) Run the app 3) Tap on tab 2 4) Tap on tab 1 Actual result: 2) After step 2,the following appears in the console/logcat: I/TiAPI (10430): -------------> win1 focus event fired! - win 1 I/TiAPI (10430): -------------> tab1 focus event fired! - Tab 1 I/TiAPI (10430): -------------> tabGroup focus event fired! - Tab 1 3) After step 3,the following appears in the console/logcat: I/TiAPI (10430): **************> win1 blur event fired! - win 1 I/TiAPI (10430): -------------> win2 focus event fired! - win 2 I/TiAPI (10430): **************> tab1 blur event fired! - Tab 1 I/TiAPI (10430): -------------> tab2 focus event fired! - Tab 1 I/TiAPI (10430): -------------> tabGroup focus event fired! - Tab 1 4) After step 4,the following appears in the console/logcat: I/TiAPI (10430): **************> win2 blur event fired! - win 2 I/TiAPI (10430): -------------> win1 focus event fired! - win 1 I/TiAPI (10430): **************> tab2 blur event fired! - Tab 2 I/TiAPI (10430): -------------> tab1 focus event fired! - Tab 2 I/TiAPI (10430): -------------> tabGroup focus event fired! - Tab 2 Expected result 2) After step 2,the following appears in the console/logcat: -------------> tab1 focus event fired! - Tab 1 -------------> tabGroup focus event fired! - Tab 1 -------------> win1 focus event fired! - win 1 3) After step 3,the following appears in the console/logcat: I/TiAPI (10262): **************> tab1 blur event fired! - Tab 1 I/TiAPI (10262): **************> win1 blur event fired! - win 1 I/TiAPI (10262): -------------> tab2 focus event fired! - Tab 2 I/TiAPI (10262): -------------> tabGroup focus event fired! - Tab 2 I/TiAPI (10262): -------------> win2 focus event fired! - win 2 4) After step 4,the following appears in the console/logcat: I/TiAPI (10262): **************> tab2 blur event fired! - Tab 2 I/TiAPI (10262): **************> win2 blur event fired! - win 2 I/TiAPI (10262): -------------> tab1 focus event fired! - Tab 1 I/TiAPI (10262): -------------> tabGroup focus event fired! - Tab 1 I/TiAPI (10262): -------------> win1 focus event fired! - win 1

Attachments

FileDateSize
2.0.2 tabgrouplogging.rtf2012-06-27T00:28:25.000+00001262
2.1.0 tabgroupLogging.rtf2012-06-27T00:28:25.000+00001257

Comments

  1. Eric Merriman 2012-06-27

    Verified on additional devices that this is a regression from 2.0.2. To help clarify a tiny bit, switching to tab 2 gives: I/TiAPI ( 3005): **************> win1 blur event fired! - win 1 I/TiAPI ( 3005): -------------> win2 focus event fired! - win 2 I/TiAPI ( 3005): **************> tab1 blur event fired! - Tab 1 I/TiAPI ( 3005): -------------> tab2 focus event fired! - Tab 1 I/TiAPI ( 3005): -------------> tabGroup focus event fired! - Tab 1 The last two lines should read "TAB 2" ...and switching back to tab 1: I/TiAPI ( 3005): **************> win2 blur event fired! - win 2 I/TiAPI ( 3005): -------------> win1 focus event fired! - win 1 I/TiAPI ( 3005): **************> tab2 blur event fired! - Tab 2 I/TiAPI ( 3005): -------------> tab1 focus event fired! - Tab 2 I/TiAPI ( 3005): -------------> tabGroup focus event fired! - Tab 2 The last two lines should read "TAB 1"
  2. Josh Roesslein 2012-06-27

    Created [PR #2481](https://github.com/appcelerator/titanium_mobile/pull/2481) to resolve this issue in master. A backport to 2_1_X will follow shortly once this PR is approved.
  3. Josh Roesslein 2012-06-27

    Created [PR #2483](https://github.com/appcelerator/titanium_mobile/pull/2483) to backport fix into 2_1_X.
  4. Olga Romero 2012-06-27

    Verified fix with: Titanium Studio, build: 2.1.0.201206251749 Titanium SDK: 2.1.0.v20120627151616 LG VS910 4G Android version 2.3.6
  5. Shameer Jan 2013-12-10

    Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5074

JSON Source