From 9bbfb420f99e87f1cc597bc721c209710ca2b6d1 Mon Sep 17 00:00:00 2001 From: James Mills Date: Tue, 31 Mar 2020 21:26:56 +1000 Subject: Fixed UI/UX bug with pressing tab or enter on url input field --- static/import.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'static/import.js') diff --git a/static/import.js b/static/import.js index aa29b87..29922f6 100644 --- a/static/import.js +++ b/static/import.js @@ -75,10 +75,20 @@ const bytesToSize = (bytes) => { /* MAIN */ document.addEventListener('DOMContentLoaded', () => { - importInput.addEventListener("keyup", (e) => { - if (e.keyCode === 13) { + importInput.addEventListener("keypress", (e) => { + if (e.keyCode == 9) { + urlSelected(); e.preventDefault(); + e.stopPropagation(); + return; + } + + if (e.keyCode === 13 || e.keyCode == 10) { + e.preventDefault(); + e.stopPropagation(); + urlSelected(); importButton.click(); + return; } }); }, false) -- cgit v1.2.3