Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-4988] Android: evalJS causes text input field to blur and removes keyboard

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionCannot Reproduce
Resolution Date2013-04-26T07:54:42.000+0000
Affected Version/sRelease 1.7.2, Release 2.1.0
Fix Version/s2013 Sprint 09
ComponentsAndroid
Labelscore
ReporterJon Alter
Assigneejithinpv
Created2011-08-11T15:43:42.000+0000
Updated2017-03-17T18:47:16.000+0000

Description

When you focus on a text input field in a webview and evalJS runs, it blurs the focus you have on the text field and the keyboard disappears. Step 1: run the code below Step 2: tap on the text area in the webView Step 3: wait a few seconds Step 3: notice that the text area blurs and the keyboard drops when evalJS runs
var tabGroup = Titanium.UI.createTabGroup();
var win = Titanium.UI.createWindow({
    title:'win_test'
});
var webView = Titanium.UI.createWebView();
win.add(webView);
webView.url = 'test.html';
intervalFunc = function(){
    Ti.API.info("### evalJS ###");
    var r = webView.evalJS(
        'getEvents()'
    );
}
var tab = Titanium.UI.createTab({
    icon:'',
    title:'Test',
    window:win       
});
var interval = setInterval(intervalFunc, 5000);
tabGroup.addTab(tab);
tabGroup.open();
<html>
<head>
    <title>blubb</title>          
</head>
<body>
<input type="text" value="test" name="testName">
<script type="text/javascript">
getEvents = function(){    
    return "";
}
</script>   
</body>
</html>

Associated Helpdesk Ticket

http://appc.me/c/APP-899769

Comments

  1. Junaid Younus 2012-07-12

    Tested on a Samsung Galaxy S2, with 2.1GA. I'm unsure if it's behaving as it should do or not. They keyboard does get blurred and it shows up a runtime error saying "Uncaught Error: Only the original thread that created a view hierarchy can touch its view. Source: var r = webView.evalJS('getEvents()');" Added the 2.1.0 tag in the ticket.
  2. jithinpv 2013-04-26

    cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Android Emulator: Android SDK version: 2.2
  3. Lee Morris 2017-03-17

    Closing ticket as the issue cannot be reproduced.

JSON Source