Safari for iOS doesn't trigger keyboard events on DOM elements that are not components of a form. This includes the document and body which are usually used to capture keystrokes anywhere on the page.
The only way to trigger a keystroke event on document or body of a page is to trigger it in an input or textarea. In that case, the event will correctly 'bubble' to the body and document.
However, this might be a problem because Safari for iOS doesn't allow us to give an element focus from javascript.
At the moment, we are using a solution where user has to click on an input field before starting the first scan, and the input field is then moved off-screen but retains focus.
If someone has a better solution, please share.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…