[TIMOB-11561] keyboardToolbar of textField not being displayed on textField.focus()
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-10-31T00:04:29.000+0000 |
Affected Version/s | Release 2.1.3 |
Fix Version/s | Release 2.1.4, Release 3.0.0, Release 3.1.0, 2012 Sprint 22 API, 2012 Sprint 22 |
Components | iOS |
Labels | api, developer-preview, module_textfield, qe-testadded, regression |
Reporter | Amuktha Akkinepally |
Assignee | Vishal Duggal |
Created | 2012-10-23T23:17:55.000+0000 |
Updated | 2013-10-04T07:22:26.000+0000 |
Description
The Keyboard Toolbar on top of the key board does not appear once the textField is blurred and then re focussed. This works fine on 2.1.0, 2.1.1, 2.1.2 GAs.
Steps to reproduce:
1. Load the app with below app.js 2. Make sure the app on Ti SDK 2.1.3GA 3. Enter a value greater than 10. 4. Click on the 'button' Actual Result: The Keyboard toolbar just disappears. Expected Result: The Keyboard toolbar should not disappear like on 2.1.2 SDK. app.js:
var win = Titanium.UI.createWindow({
backgroundColor:'white',
title:'window',
barColor:'#ff7b01',
top:0
});
var b = Titanium.UI.createButton({
title:'Button',
style:Titanium.UI.iPhone.SystemButtonStyle.DONE
});
b.addEventListener('click',function(){
txtField.blur();
})
var flexSpace = Titanium.UI.createButton({
systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});
var txtField = Titanium.UI.createTextField({
color : '#ff7c00',
font : {
fontSize : 16,
fontWeight : 'bold',
fontFamily : 'Helvetica Neue'
},
top : 19,
textAlign : 'right',
height : 50,
left:'65%',
right : '10%',
keyboardType : Titanium.UI.KEYBOARD_NUMBER_PAD,
returnKeyType : Titanium.UI.RETURNKEY_DEFAULT,
borderStyle : Titanium.UI.INPUT_BORDERSTYLE_ROUNDED,
keyboardToolbarColor:'#898989',
keyboardToolbar:[flexSpace,b,flexSpace]
});
txtField.addEventListener('blur',function(e){
if(e.value > 10){
txtField.value = '';
/*setTimeout(function(){
txtField.focus()},1000)*/
txtField.focus();
}
})
win.add(txtField);
win.open()
Focusing inside blur events and blurring inside focus events is a really bad design so no we will not fix race conditions. Anyways from what I can see of the app, the whole value verification can be done on the click listener of the button.
Not only that, but disallowing the user to change fields is a [direct violation of Apple's HIG and grounds for app rejection](https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Principles/Principles.html#//apple_ref/doc/uid/TP40006556-CH5-SW6) bq. People, not apps, should initiate and control actions. Although an app can suggest a course of action or warn about dangerous consequences, it’s usually a mistake for the app to take decision-making away from the user. Moving to mark as invalid.
Will see if tis can be handled.
master PR https://github.com/appcelerator/titanium_mobile/pull/3355 3_0_X PR https://github.com/appcelerator/titanium_mobile/pull/3365 2_1_X PR https://github.com/appcelerator/titanium_mobile/pull/3366
Tested with 2.1.4.v20121030173408 on iPhone 4s 6.0