Files
inventory/static/js/scanner.js
2026-03-08 00:52:03 +08:00

21 lines
523 B
JavaScript

(function () {
const input = document.getElementById("scan-input");
const form = document.getElementById("scan-search-form");
if (!input || !form) {
return;
}
// Keep focus for barcode scanners that type and send Enter immediately.
window.addEventListener("load", function () {
input.focus();
});
document.addEventListener("keydown", function (event) {
if (event.key === "Escape") {
input.value = "";
input.focus();
}
});
})();