diff --git a/static/scripts/main.js b/static/scripts/main.js index 8fe8ca9..ae14e39 100644 --- a/static/scripts/main.js +++ b/static/scripts/main.js @@ -42,15 +42,17 @@ async function loadCash(price) { } async function indexOnLoad(){ - document.body.addEventListener('click', focusBarcodeInput, true); + // document.body.addEventListener('click', focusBarcodeInput, true); loadProducts(); - document.querySelector("input[autofocus]").addEventListener("blur", function() { - var t = this; - t.focus(); - setTimeout(function() { // Some browsers won't let you do it until - t.focus(); // after the blur has completed - }, 100); - }); + + const bardcodeInputField = document.getElementById('barcode_form') + bardcodeInputField.focus() + + bardcodeInputField.addEventListener('blur', function() { + setTimeout(() => { + bardcodeInputField.focus(); + }, 0) + }) } function focusBarcodeInput(){ diff --git a/static/style/main.css b/static/style/main.css index 84ab1ba..bce962f 100644 --- a/static/style/main.css +++ b/static/style/main.css @@ -1,3 +1,8 @@ +html, body { + margin: 0; + height: 100%; +} + body{ background-color: #D9F2D0; }