Enable/Disable Android virtual keyboard with dummy textarea

一个人想着一个人 提交于 2019-12-11 06:46:47

问题


I want to have virtual keyboard for jquery terminal, here is my test code: http://terminal.jcubic.pl/android.html the plugin code is here: http://terminal.jcubic.pl/js/jquery.terminal-src.js (uncommitted)

For a moment it was working but it stopped, even then I run focus and blur on textarea the keyboard don't show up. The cursor is not in textarea. The focus/blur work when I run the page on desktop Chromium.

Anybody know why textarea don't have focus?

Sometimes the cursor is inside but the keyboard don't show up and there is no that green outline. Sometime it get focus but then blur. Virtual keyboard show up only when I click inside textarea. I can't find any code that may cause this and why it was working for a moment (but not exactly I wanted).

I've try:

$('textarea').blur(function() { return false; });

or call preventDefault when I click the terminal. (the textarea is my clipboard but I want to reuse it). I keep trying different things with no success.


回答1:


I've solve the issue, two things about andorid I've found. You can't delay action that trigger focus on textarea/input it need to be direct call (stack of focus call need point to html/browser native action), and it's seems that you can focus (trigger virtual keyboard) only on native events, (for instance you can't focus on load).



来源:https://stackoverflow.com/questions/23859493/enable-disable-android-virtual-keyboard-with-dummy-textarea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!