Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 500
Fenix Avatar asked Nov 10 '14 09:11

Fenix


1 Answers

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" />
like image 91
lloiser Avatar answered Oct 22 '22 20:10

lloiser