Take Input Keyboard to Textfield without Focus on this field

Hi, I’m looking for solution to take Input from Keyboard or at this time from Mobile Scanner (which acts as Keyboard) to Textfield.
I dont always have set focus on this field. This is the only textfield in this view.
Thanks in advance!

I’m using Vaadin 23

You can programmatically set the value of a text field with setValue(). I’m not sure what kind of mobile scanner you are using or how that works. Please share some more details

Also noting that with textField.focus() you can force the TextField be focused.

I don’t think it is possible to have the keyboard input to go to a Textfield that isn’t focused. That is part of the Browser and not Vaadin. We also have the same problem when supported barcode scanner / mobile scanners. We have solved it by having a central textfield that grabs so focus as soon as it loses it.

downside is that you can basically can only have this one inputfield

If you find a better solution please let me know

Back in Vaadin 8 we build an extension and listened to a certain character in the browser started a “scanmode” which intercepted and collected all input till an set end character was scanned. The collected input was than send to the server. Upside is you don’t need a textfield that grabs the focus, downside is all your barcodes need an start and end character, you need to write a lot of Javascript and Users can stuck in scanmode when they use the keyboard and accidently type the start character (barcodes have a very limited number of characters)

Hi! Thank You for feedback. I’m using Honeywell CT45XP.
Basicaly its just one field visible in this view.
I scan barcode and with setValueChangeMode Lazy i start method which is looking for data to this Barcode/Package.
After i found it i show other package data visible.
I would like to avoid that user click somewhere else on the screen and this first textfield will lost focus and then if he scans new barcode nothing happens.

textfield.addBlurlistener(event → textfield.focus(); That should be enough 99% of the time in your case

We a similar device von Datalogic. Basically it’s a Android smartphone with an integrated barcode scanner.

do you have a solution for the keyboard that pops of when you focus the textfield?

I’m using Fully Kiosk app. There are many usefull options and i can recommend it. Among others one option is “hide keyboard”. It makes another Problem. When i hide android keyboard i get no input from scanner also. But this is different topic.

I think we use that too

great! addBlurListener as you mentioned above works as i wanted! thank You!