Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2547] TextField never looses focus when action performed in Blur event (re-focuses afterwards)

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2012-10-11T20:35:20.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsblur, focus, ios, textfield
ReporterGavin Harriss
AssigneeMauro Parra-Miranda
Created2012-10-09T22:44:20.000+0000
Updated2016-03-08T07:41:36.000+0000

Description

As of 2.1.3.GA it's no longer possible to loose focus from TextFields if you're performing some action in the 'blur' event. Blur event code will fire, but the TextField will gain focus again, making the keyboard active again and so preventing access to UI elements obscured by the keyboard. Interestingly, the 'focus' event does not seem to get fired when the TextField gets the focus again (but not 100% sure!). Below is an example of some code that triggers this. This code simply removes a background color I'm applying to a TableRow highlighting the data item being edited.
txtUsername.addEventListener('blur', function(e) {
	FM.settings.setUsername(txtUsername.value.trim());
	txtOnBlur(e);
});

function txtOnBlur(e) {
	var truerow = FM.ui.helper.getTrueRowByType(e.source)
	truerow.setBackgroundColor(FM.ui.theme.tableViewRowBackgroundNormal);
};

Comments

  1. Vishal Duggal 2012-10-11

    Looks like a duplicate of TC-1343 with a textField in a tableView. Fix was pushed to 2_1_X branch a few days ago. Marking this as resolved. If the problem persists please reopen the issue. Would appreciate a bigger code sample.
  2. Mauro Parra-Miranda 2013-11-24

    Closing since it's a dup.

JSON Source