From 77259c1576a2d664ddb5c5c62d76d2117cfdb20a Mon Sep 17 00:00:00 2001 From: Timothee Groleau Date: Fri, 9 Aug 2024 17:11:53 +0800 Subject: [PATCH] fix: showOpenFilePickerPolyfill wnow works in safari --- public/emu/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/public/emu/main.js b/public/emu/main.js index c183d2d7..9891a12b 100644 --- a/public/emu/main.js +++ b/public/emu/main.js @@ -652,6 +652,12 @@ function showOpenFilePickerPolyfill(options) { .join(','); } + // See https://stackoverflow.com/questions/47664777/javascript-file-input-onchange-not-working-ios-safari-only + input.style.position = 'fixed'; + input.style.top = '-100000px'; + input.style.left = '-100000px'; + document.body.appendChild(input); + input.addEventListener('change', () => { resolve( [...input.files].map(file => {