mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-12 03:45:34 +00:00
fix(android/engine): Fix backspace on Android 5.0
This commit is contained in:
parent
f639ad55a3
commit
31b0cf1fb4
1 changed files with 22 additions and 0 deletions
|
|
@ -39,6 +39,7 @@
|
|||
kmw['setActiveElement'](ta);
|
||||
|
||||
ta.readOnly = false;
|
||||
checkTextArea();
|
||||
|
||||
// Tell KMW the default banner height to use
|
||||
com.keyman.osk.Banner.DEFAULT_HEIGHT =
|
||||
|
|
@ -327,6 +328,27 @@
|
|||
return hexString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the WebView version and determine if the textarea that KeymanWeb uses needs to be "visible".
|
||||
* Normally, this textarea is not displayed to avoid redundant layout calculations.
|
||||
* In older WebViews on Android 5.0 though, selectionStart and selectionEnd positions fail to
|
||||
* update unless the textarea is visible.
|
||||
* Reference: Issue #5376
|
||||
*/
|
||||
function checkTextArea() {
|
||||
var uaRe = /Chrome\/([0-9]*)./g;
|
||||
var chromeMajorVersion = uaRe.exec(navigator.userAgent);
|
||||
if (chromeMajorVersion && parseInt(chromeMajorVersion[1]) <= 37) {
|
||||
var ta = document.getElementById('ta');
|
||||
if (ta != null) {
|
||||
ta.style.display = '';
|
||||
ta.style.position = 'absolute';
|
||||
ta.style.left = '-500px';
|
||||
ta.style.top = '0px';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
body {background-color:#000000;}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue