It is not working because you have focused on a text field, by default text field will open the keyboard. You can handle it in several ways.
First don't focus on a text input and focus on a div or any other element, and there should be a event on that div or that other element, when CHAR(13) or carriage return is read from the barcode it should put it that value in a hidden input to submit the form. I am guess that you already know how form works.
2nd way, make the text disabled and do the same process as first one it should work , this case you don't need hidden input.
3rd way, you can also hide the text input with display:none which should also fix the problem.
4th, do a blur after the focus and handle the scenario.
Let me know if any works.