I am building a web app which includes scanning of QR codes using a bluetooth scanner. To get the data, the scanner behaves like a keyboard so the data it scans is ‘typed’ into an input field. I’ve made the input invisible and set it to have focus so it all works. However, mobile browsers insist on showing the on-screen keyboard because it’s a text field which has focus. If you close the keyboard, the field loses its focus so the scanner doesn’t work.
Can anyone help with preventing the keyboard from showing?
The scanner is effectively a bluetooth keyboard. I’ve tried making the input readonly but that means the characters sent by the scanner aren’t entered.
There must be a way to have the input field active and with focus but not show the onscreen keyboard.
Unfortunately it doesn’t make any difference. Once the input has focus (and it needs focus in order for the scanner to ‘type’ the info into it) the keyboard appears regardless of input type.
Could you not first populate a variable to store the initial input and then echo this to the read-only form input? ie, set the form input to bind to the variable?
This doesn’t completely hide the keyboard but makes it almost hidden - there’s a small part at the bottom of the screen but it’s good enough. I just need to tell people not to tap ‘Done’ otherwise the input loses focus and the scanner doesn’t work.