fix escaping focus

fix #67
This commit is contained in:
s72785 2015-07-21 21:22:06 +02:00
parent 802f9d775f
commit 9d9c80dd6a

View file

@ -20,7 +20,8 @@ function hideBarcode() {
function barcodeKeyPress(event) {
var key = String.fromCharCode(event.charCode)
var input = document.getElementById('crement')
if ( input ) {
var inputcount = document.querySelectorAll('[type="text"]').length + document.querySelectorAll('[type="number"]').length
if ( input && inputcount == 1 ) {
input.focus()
}
var focused = document.activeElement
@ -29,7 +30,7 @@ function barcodeKeyPress(event) {
} else if ( document.querySelector ) {
focused = document.querySelector(":focus")
}
if ( focused == null || focused.tagName != "INPUT" ) {
if ( inputcount <= 1 && ( focused == null || focused.tagName != "INPUT" ) ) {
if ( event.keyCode === 13 ) {
var input = document.getElementById('barcodeInput')
if (input && barcodeBuf.length > 0) {