diff --git a/pkg/emscripten/libretro-thread/libretro.js b/pkg/emscripten/libretro-thread/libretro.js index f1237e864d..324c4cc44a 100644 --- a/pkg/emscripten/libretro-thread/libretro.js +++ b/pkg/emscripten/libretro-thread/libretro.js @@ -208,14 +208,18 @@ function uploadFiles(accept) { input.type = "file"; input.setAttribute("multiple", ""); if (accept) input.accept = accept; - input.onchange = async function() { + input.style.setProperty("display", "none", "important"); + document.body.appendChild(input); + input.addEventListener("change", async function() { let files = []; for (const file of this.files) { files.push({path: file.name, data: await readFile(file)}); } + document.body.removeChild(input); resolve(files); - } + }); input.oncancel = function() { + document.body.removeChild(input); resolve([]); } input.click();