how to show and hide soft-keyboard on Android (Chrome) programmatically?

We’re evaluating Vaadin 23+ to implement a mobile website targeting an Android device and Chrome. One problem we’re facing: we’ll often use a barcode scanner to input data. Is it possible to programmatically decide when the soft-keyboard appears? The ideal solution would not show the keyboard when a TextField is focused, but show a keyboard icon to show/hide it on user request. Thx.

There is no specific API for it, but you could try using setReadOnly on the field

but we need to use the keyboard, if a barcode is unreadable

is there a chance to add/remove attributes to/from the input nested in TextField?

That’s possible and also your idea with using a button as suffix component to enable the field would also work

have you got a hint on how to access the input?

.executeJs(“this.inputElement.setAttribute(‘aria-label’, ‘Search’)”);

thanks, that helped a lot. Scanners are tricky anyway, triggering the soft-keyboard in unexpected ways