[TIMOB-4988] Android: evalJS causes text input field to blur and removes keyboard
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Cannot Reproduce |
Resolution Date | 2013-04-26T07:54:42.000+0000 |
Affected Version/s | Release 1.7.2, Release 2.1.0 |
Fix Version/s | 2013 Sprint 09 |
Components | Android |
Labels | core |
Reporter | Jon Alter |
Assignee | jithinpv |
Created | 2011-08-11T15:43:42.000+0000 |
Updated | 2017-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>
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.
cannot reproduce Tested with Titanium Studio, build: 3.0.1.201212181159 Titanium SDK version: 3.1.0 Android Emulator: Android SDK version: 2.2
Closing ticket as the issue cannot be reproduced.