Problem Description
Textfield events are not getting fired properly in mobileweb. You got stuck into focus event.
Actual Results
The alert is stuck in focus event.
Expected results
The events working as in iOS.
Testcase
1. Create new mobile project.
2. Add app.js
var win = Titanium.UI.createWindow({
backgroundColor:'#000',
top:0
});
var inputTextField = Titanium.UI.createTextField({
color : '#ff7c00',
top:10,
height : 50,
width : '25%',
left : '10%',
borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
keyboardType : Titanium.UI.KEYBOARD_NUMBERS_PUNCTUATION,
returnKeyType : Titanium.UI.RETURNKEY_DONE,
font : {
fontSize : 20,
fontColor : '#ff7c00',
fontWeight : 'bold',
fontFamily : 'Helvetica Neue'
}
});
inputTextField.addEventListener('focus',function(){
alert('focus')
});
inputTextField.addEventListener('blur',function(){
alert('blur')
});
inputTextField.addEventListener('change',function(){
alert('change')
});
inputTextField.addEventListener('return',function(){
alert('return')
});
win.add(inputTextField);
win.open();
3. It's running nice on iOS, but it's failing on mobile web.
Behavior is correct. The alert window causes the text field to blur, which fires the blur event. When you click OK and the alert window disappears, it causes the text field to focus, which creates an alert, rinse and repeat. iOS doesn't exhibit this behavior because there is a bug that prevents alert dialogs from focusing/blurring windows.
Why doesn't IOS fire blur on text field when the alert comes up?
After some discussion with Blain, I learned that iOS doesn't quite use the same focus/blur model as Mobile Web. In iOS, something is focused when it becomes visible, but in Mobile Web (and maybe Android?), something becomes focused when it becomes the "focused" element (think tabbing through a web page). In iOS, since an alert doesn't obscure the entire window, it doesn't fit the focus/blur model and thus nothing happens. This could be something to consider for parity purposes, but it doesn't seem to be a bug in the classic sense.
Closing ticket as invalid.