From b8aee1d2b5f09ae68f46e00f83eccff2dcf0bb55 Mon Sep 17 00:00:00 2001 From: James Mills Date: Sun, 29 Mar 2020 16:31:36 +1000 Subject: Fixed a UI/UX bug with pressing enter on the importInput text input in the import screen --- static/import.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'static') diff --git a/static/import.js b/static/import.js index 9f1eff6..aa29b87 100644 --- a/static/import.js +++ b/static/import.js @@ -72,24 +72,15 @@ const bytesToSize = (bytes) => { return (bytes / Math.pow(1024, i)).toFixed(1) + ' ' + sizes[i] } -const determineDragAndDropCapable = () => { - const div = document.createElement('div') - return (('draggable' in div) - || ('ondragstart' in div && 'ondrop' in div)) - && 'FormData' in window - && 'FileReader' in window -} - /* MAIN */ document.addEventListener('DOMContentLoaded', () => { - ['drag', 'dragstart', 'dragend', 'dragover', 'dragenter', 'dragleave'] - .forEach((evt) => { - importForm.addEventListener(evt, (e) => { - e.preventDefault() - e.stopPropagation() - }) - }) + importInput.addEventListener("keyup", (e) => { + if (e.keyCode === 13) { + e.preventDefault(); + importButton.click(); + } + }); }, false) const labelClicked = (e) => { -- cgit v1.2.3