From f5a056b0866984b42ea479d64c897722a8ccdd82 Mon Sep 17 00:00:00 2001 From: BinBashBanana <51469593+BinBashBanana@users.noreply.github.com> Date: Thu, 3 Apr 2025 10:24:06 -0700 Subject: [PATCH] Fix safari file uploads --- pkg/emscripten/libretro-thread/libretro.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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();