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).
you can try to create a hidden input which receives the focus once your visible input field loses it.
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" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With