Made autofocus more consistent

This commit is contained in:
Yarne Coppens 2024-09-07 00:03:10 +02:00
parent 717624a922
commit 193703ff5a
2 changed files with 15 additions and 8 deletions

View file

@ -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(){

View file

@ -1,3 +1,8 @@
html, body {
margin: 0;
height: 100%;
}
body{
background-color: #D9F2D0;
}