Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11679] Android: Text field triggers "focus" event of TiUIWindow

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2013-04-18T17:37:02.000+0000
Affected Version/sRelease 2.1.3, Release 3.0.0
Fix Version/sn/a
ComponentsAndroid
LabelsCommunity, exalture
ReporterFederico Casali
AssigneeSunila
Created2012-08-17T04:51:03.000+0000
Updated2017-03-22T22:36:10.000+0000

Description

Problem description

If window has "focus" event listener attached and it contains text fields, text fields triggers window's focus event.

Sample code

var win = Ti.UI.createWindow({
	backgroundColor: '#000',
	layout: 'vertical',
	navBarHidden: true
});

for (var i = 0; i < 10; ++i) {
	var tf = Ti.UI.createTextField({
		width: 200
	});
	win.add(tf);
}


win.addEventListener('focus', function() {
	Ti.API.info('Window focused!');
});

win.open();
Clicking on the textFields not focused, the windows 'focus' event listener is triggered.

Expected behavior:

Text fields 'focus' event listener should not be triggered in this case

Comments

  1. Federico Casali 2012-11-06

    Confirmed. Moving to TIMOB
  2. Sunila 2013-04-18

    'focus' event bubbles from child to parent, child can cancel the bubbling by setting the 'cancelBubble' property on the event in the child's event handler.
  3. Lee Morris 2017-03-22

    Closing ticket as invalid.

JSON Source