Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-9428] IOS: Events are not working in iOS

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2012-06-14T16:36:11.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelsparity
ReporterMauro Parra-Miranda
AssigneeBryan Hughes
Created2012-06-06T16:10:02.000+0000
Updated2017-03-09T23:30:02.000+0000

Description

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.

Comments

  1. Bryan Hughes 2012-06-14

    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.
  2. Vishal Duggal 2012-06-14

    Why doesn't IOS fire blur on text field when the alert comes up?
  3. Bryan Hughes 2012-06-14

    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.
  4. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source