Made autofocus more consistent
This commit is contained in:
parent
717624a922
commit
193703ff5a
2 changed files with 15 additions and 8 deletions
|
|
@ -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(){
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
html, body {
|
||||
margin: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body{
|
||||
background-color: #D9F2D0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue