Maybe really fixed autofocus issue
This commit is contained in:
parent
3bed47458f
commit
4ae196156b
2 changed files with 6 additions and 1 deletions
|
|
@ -42,6 +42,7 @@ async function loadCash(price) {
|
|||
}
|
||||
|
||||
async function indexOnLoad(){
|
||||
document.body.addEventListener('click', focusBarcodeInput, true);
|
||||
loadProducts();
|
||||
document.querySelector("input[autofocus]").addEventListener("blur", function() {
|
||||
var t = this;
|
||||
|
|
@ -52,6 +53,10 @@ async function indexOnLoad(){
|
|||
});
|
||||
}
|
||||
|
||||
function focusBarcodeInput(){
|
||||
document.getElementById('barcode_input').focus()
|
||||
}
|
||||
|
||||
async function loadProducts() {
|
||||
const loadProductRequest = new Request(api_url + "/products")
|
||||
all_products = await makeAPIRequest(loadProductRequest)
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<link rel="stylesheet" href="{{url_for('static', filename='style/main.css')}}">
|
||||
</head>
|
||||
|
||||
<body onload="indexOnLoad()">
|
||||
<body onload="indexOnLoad()" onclick="focusBarcodeInput()">
|
||||
<form action="" id="barcode_form">
|
||||
<input id="barcode_input" type="text" autofocus>
|
||||
<input type="submit" value="Submit">
|
||||
|
|
|
|||
Loading…
Reference in a new issue