Is there a way to capture a keypress on the overall app? I would think you could add the following code to the preloaded JS but it doesn't work because of the way Retool is ran in a sandbox. Is the a work around?
window.addEventListener('keypress', e => {
console.log(e.key);
});
Unfortunately that will not work. What I am attempting to do is capture a barcode scan from a handheld barcode scanner. The scanner sends the scanned data as if it were typed from a keyboard. I would like to capture the keypress at the window level so that I can scan and take action without a text field having focus. Does anyone know if this is possible?
Would it work if — on page load — you autofocused on a textinput?
(I don't believe it's possible to capture the keypress at the window level, but maybe others more knowledgeable about Retool will be able to chime in.)
Hi @KyleKelsch, welcome to the forum!
As a workaround, if you have access to a Zebra Android device, you could use this template to manage your inventory.