| GitHub Issue | n/a |
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-02-06T19:33:07.000+0000 |
| Affected Version/s | Release 3.0.0, Release 3.0.2 |
| Fix Version/s | 2014 Sprint 03, 2014 Sprint 03 API, Release 3.2.3, Release 3.3.0 |
| Components | Android |
| Labels | module_textfield, qe-closed-3.2.3, qe-testadded, supportTeam, triage |
| Reporter | Betty Tran |
| Assignee | Ping Wang |
| Created | 2013-03-08T15:42:16.000+0000 |
| Updated | 2014-04-18T23:47:11.000+0000 |
Description
When we open a html page that contains textfields inside a webview, clicking on the textfields do not open the soft keyboard in some Android OS versions (tested on 2.3.5).
Code to Reproduce
app.js
var win = Ti.UI.createWindow();
var web = Ti.UI.createWebView({
height: Ti.UI.FILL,
width: Ti.UI.FILL,
url: 'textfield.html'
});
win.add(web);
win.open();
textfield.html
<html>
<head>
<title>Test for textfields</title>
</head>
<body>
<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
</body>
</html>
Workaround
It seems to work if we set the softKeyboardOnFocus property on the webview to either Titanium.UI.Android.SOFT_KEYBOARD_HIDE_ON_FOCUS, or Titanium.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS and then do web.focus().
The problem does not exist with android 4.0.4(titanium sdk 3.0.2 and 3.1.0) and works fine on iphone emulator tested on Titanium Studio, build: 3.0.2.201302191606 Titanium SDK version: 3.1.0 Titanium SDK version: 3.0.2 Device: Samsung galaxy s duos Android version: 4.0.4 Android Emulator: Android SDK version: 2.2 iOS iPhone Simulator: iOS SDK version: 6.0
Work around did not work. The keyboard occasionally did not pop up when we tapped into the input field. Where occasionally means "1 out of 3 attempts". Developer could replicate on Android 2.3.5 device (including me was Droid Razr 2.3.5 w/ TiSDK 3.1.3.GA). Their kindle fire version is also affected by this bug. Whenever the keyboard pop up you can see similar logs, I.E.
First attempt (keyboard did pop up):
Second attempt (keyboard did pop up):
Third attempt (keyboard did not pop up):
Whenever the keyboard fails and textFields can't gain focus there are not significative logs to narrow down the issue.Snippet code
app.js
var win = Ti.UI.createWindow(); var web = Ti.UI.createWebView({ height: Ti.UI.FILL, width: Ti.UI.FILL, //url: 'textfield.html' url: 'test.html' }); win.add(web); win.open();test.html
Steps to replicate
1) Launch sample posted originally or use above. 2) Tap a TiUITextField (it may or not open keyboard). 3) Close app via Back button - please repeat steps multiple times.Additional details
As proposed by the Android docs, tag changes does not seem to come into play when setting html attributes: {quote} "You can define multiple viewport properties in the tag's content attribute." {quote} - http://developer.android.com/guide/webapps/targeting.htmlmaster PR: https://github.com/appcelerator/titanium_mobile/pull/5251 For FR, please run KS and Anvil to make sure no new regressions. The test case seems only fail on Droid Razr 2.3.5, so we need [~egomez] to help with testing.
Tested and verified ensures popping up the keyboard: Titanium Command-Line Interface, CLI version 3.2.1-beta3 Alloy 1.3.1-beta3 Titanium SDK version 3.3.0.TIMOB-13002 Mac OSX : 10.8.5 Droid Razr 2.3.5
3_2_X Backport : https://github.com/appcelerator/titanium_mobile/pull/5508
Verified with test Environment: Appc Studio:3.2.3.201403190645 Sdk:3.2.3.v20140324164913 alloy:1.3.1 titanium:3.2.1 titanium-code-processor:1.1.0 Osx: Maverick(10.9.2) Device:LG-P970(V4.0.4),Nexus7(v4.3) HTML textfield inside webView opens Keyboard successfully. Hence closing this issue. New Bugged logged TIMOB-16695(as not working properly with android (v4.4.2)