Expected behavior
Click events should be fired on the tab regardless of whether or not the tab is currently selected.
Actual behavior
The click event in a tab element of a tabGroup is not fired in either Titanium versions listed above
Note that this also did not work on Android 1.7.5, but the issue has been fixed in Android 1.8.0.1. Thus, this is a parity issue to match a recent Android feature request (see linked ticket).
Test case
With the following code, no click event is fired on iOS when tab1 is clicked:
Ti.UI.setBackgroundColor('#000');
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var tab1 = Ti.UI.createTab({
title:'Tab 1',
window:win1
});
var label1 = Ti.UI.createLabel({
color:'#999',
text:'I am Window 1',
textAlign:'center',
width:'auto'
});
win1.add(label1);
var win2 = Ti.UI.createWindow({
title:'Tab 2',
backgroundColor:'#fff'
});
var tab2 = Ti.UI.createTab({
title:'Tab 2',
window:win2
});
var label2 = Ti.UI.createLabel({
color:'#999',
text:'I am Window 2',
textAlign:'center',
width:'auto'
});
win2.add(label2);
tabGroup.addTab(tab1);
tabGroup.addTab(tab2);
tabGroup.open();
tab1.addEventListener('click', function(e) {
Ti.API.info("tab1 clicked.");
});
Pull request: https://github.com/appcelerator/titanium_mobile/pull/2337 Test with attached app.js and test with KitchenSink (specifically slider).
Tested On: Titanium studio : 2.1.1.201207271312 SDK version : 2.2.0.v20120731184111 Android 4.0.4 - default ,chrome 18.0 Iphone 5.0.1 - safari mobile Mac osx - chrome 21,safari 5.1.4,firefox 14.0.1