Disable Firefox OS keyboard autohiding when touching outside the keyboard
When I tap an input field in Firefox OS, the on screen keyboard comes up. I am developing a messenger app and have a toolbar that borders the on-screen keyboard with a "Send" button.
When I tap the send button, the keyboard automatically closes which I do not want (the user may have to enter more messages).
How do I prevent the keyboard from closing when an outside touch is detected? I have searched all over the net and cannot find an answer (though it seems the Marketplace apps have this behaviour).
您可以尝试创建一个隐藏的输入,一旦您的可见输入字段丢失,就会收到焦点。
var input = document.getElementById("text");
var trap = document.getElementById("trap");
input.addEventListener("blur", function() {
trap.focus();
}, false);
#trap {
position: absolute;
width: 1px;
left: -10px;
}
<input type="text" id="text" />
<input type="text" id="trap" />
链接地址: http://www.djcxy.com/p/79754.html