HIde keyboard while maintaining focus on input


#1

In my app I need to keep the focus on a input, but the keyboard must remain closed since the user has a barcode scanner.

The problem that I have right now is that when I set the focus to my input the keyboard shows up, and when I close it using Keyboard.close() from ionic-native the focus is lost from the input, and if I set it again the keyboard shows up one again.

Is there any way to keep focus on a input with no keyboard?

Thanks


#2

Did you find any solution yet? I have exactly the same problem…


#3

IDEM no he podido resolver este tema…


#4

I do not understand why you would want to keep the focus on an input with the keyboard hidden.
It has no logic for me.

If you want to fill in the field with the result of the barcode scanner, you can do something like the following:

this.barcodeScanner.scan().then((result: string) => {
    this.myFormGroup.contols.MyControl.setValue(result);
})

#5

@ramon there are some QrCode scanners that stream the scanned object, and you can catch it by an input field. So to do that, you need to keep the input focused to receive the scanned stuff. The problem is just because the focus on the input field, its show up the keyboard. So the main question is:

How to hide the keyboard while maintaining focus on input?

Can someone answer this?