[TIMOB-27512] Android: hideSoftKeyboard() not working as of 8.2.1
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-11-06T21:18:35.000+0000 |
Affected Version/s | Release 8.2.1 |
Fix Version/s | Release 8.3.0 |
Components | Android |
Labels | android, engSchedule, escalation, keyboard, regression |
Reporter | Riduanul Islam |
Assignee | Gary Mathews |
Created | 2019-10-30T12:38:09.000+0000 |
Updated | 2019-11-06T21:18:35.000+0000 |
Description
*Issue:*
Soft Keyboard is not hiding using this method "Ti.UI.Android.hideSoftKeyboard()" on android version 8, 9 and 10. It works as expected with Ti SDK 8.2.0.GA but does not work with TI SDK 8.2.1.GA
Please see the attached gif image. Same code using 8.2.1.GA left side, using 8.2.0.GA right side.
*Steps to Reproduce:*
1. Run the following sample code on an android device or emulator.
2. Click on the textField for appearing keyboard.
3. Then click on the button for hiding it.
var win = Ti.UI.createWindow({
backgroundColor : 'white',
layout : "vertical"
});
var textField = Ti.UI.createTextField({
backgroundColor : '#fafafa',
color : 'green',
width : 250,
top : 30,
height : 40
});
// Create a Button.
var test = Ti.UI.createButton({
title : 'test',
height : 50,
width : 100,
top : 30,
});
// Listen for click events.
test.addEventListener('click', function() {
Ti.UI.Android.hideSoftKeyboard();
});
win.add(textField);
win.add(test);
win.open();
*Expected Result:*
It should hide the keyboard after clicking.
*Work-Around:*
Use the TextField
object's blur()
method instead. This still hides the keyboard in 8.2.1. However, it will also remove the focus from the TextField
which might not be what you want.
Attachments
File | Date | Size |
---|---|---|
hide.gif | 2019-10-30T12:23:59.000+0000 | 316753 |
I've confirmed that this regression was introduced as of Titanium 8.2.1. The
hideSoftKeyboard()
is removing the focus from theTextField
, but keeps the virtual keyboard. It's doing the opposite of what it should be doing. It should be keeping the focus and dismissing the virtual keyboard instead.master: https://github.com/appcelerator/titanium_mobile/pull/11309
merged to master
Verified the fix with SDK 8.3.0.v20191106103841. Closing.