Skip to content

Scaner event when you have the focus on an input box #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kendmode opened this issue Jun 15, 2019 · 3 comments
Open

Scaner event when you have the focus on an input box #5

kendmode opened this issue Jun 15, 2019 · 3 comments

Comments

@kendmode
Copy link

the event 'scan.pos.barcode' works very well when the focus is not on a text box, but when it is, the bar code is written and the 'keyup' event of my input box is activated that I want to avoid. Can you help me?

@ericuldall
Copy link
Member

Hi Dxzo. Can you give me some more details on your application? Are you using the keyup event on the specific input for another purpose? Can you share some code?

@kendmode
Copy link
Author

I have an input box that works like a search engine similar to a browser, I use it for the user to manually search for the code of their product and select it, for this I use the 'keyup' event. Now I wanted to implement the search when the client has a scanner, that is, once the user scan your product, my function will be triggered:

$ (window.document) .on ('' scan.pos.barcode '', function (event) {
// What I do with the bar code
})

This works well when the user does not have the focus in the input box, since the 'keyup' event of my search engine does not fire, but when it is, the focus conflicts because the bar code is written in the input and also my function is triggered that's what I want to avoid, I just want my function to be executed.

@ericuldall
Copy link
Member

ericuldall commented Jul 1, 2019

I think the main problem here is that the USB barcode scanner is basically treated like a keyboard. Every character it reads gets entered as a keypress event.

This would be similar to saying, "I don't want my keyboard to enter input into a text field when it's focused". I don't currently have a good solution to this as it would be mostly dependent upon how your code is structured.

However, this is not a limitation of this library, rather just a side effect of how the hardware is designed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants