[TIMOB-4345] Android: focus and blur events don't fire on window with url
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-11-05T14:44:24.000+0000 |
Affected Version/s | Release 1.7.0 |
Fix Version/s | Sprint 2011-32, Release 1.8.0 |
Components | Android |
Labels | n/a |
Reporter | Jon Alter |
Assignee | Alan Vaghti |
Created | 2011-06-07T13:19:43.000+0000 |
Updated | 2011-11-05T14:44:24.000+0000 |
Description
The focus and blur events are not fired on a window that is opened using the url property.
If you remove the url property they work fine. In app.js, if you comment out the url property, and uncomment openButton then focus and blur will work.
Step 1: Run the code below
Step 2: Notice that focus and blur do not show in your console as you open click open and close.
Step 3: In app.js, comment out the url property, and uncomment openButton.
Step 4: Run the app again.
Step 5: Notice that focus and blur events show up in your console, when you click open and close.
var tabGroup = Ti.UI.createTabGroup();
var win1 = Ti.UI.createWindow({
backgroundColor: 'blue',
url: 'win1.js'
});
win1.addEventListener('blur', function(e){
Ti.API.info('blur');
});
win1.addEventListener('focus', function(e){
Ti.API.info('focus');
});
// var openButton = Ti.UI.createButton({
// title:'open',
// height: 50,
// width: 200
// });
// win1.add(openButton);
//
// openButton.addEventListener('click', function(e){
// Ti.App.fireEvent('openwin2');
// });
var tab1 = Ti.UI.createTab({
window: win1
});
tabGroup.addTab(tab1);
tabGroup.open();
Ti.App.addEventListener('openwin2', function(e){
var win2 = Ti.UI.createWindow({
backgroundColor: 'red'
});
var closeButton = Ti.UI.createButton({
title: 'close',
height: 50,
width: 200
});
closeButton.addEventListener('click', function(e){
win2.close();
})
win2.add(closeButton);
tab1.open(win2);
});
var win1 = Ti.UI.currentWindow;
win1.addEventListener('blur', function(e){
Ti.API.info('blur');
});
win1.addEventListener('focus', function(e){
Ti.API.info('focus');
});
var openButton = Ti.UI.createButton({
title:'open',
height: 50,
width: 200
});
win1.add(openButton);
openButton.addEventListener('click', function(e){
Ti.App.fireEvent('openwin2');
});
Pull request ready https://github.com/appcelerator/titanium_mobile/pull/357
Review and merge.
Closing. Passed as expected on HTC Hero 2.1update1, Nexus S 2.3.4, LG-V909 (GSlate) 3.1. SDK: version=1.8.0 timestamp=09/06/11 15:53 githash=bc5c585...
Standardizing summary and labels.