Skip to content

Commit

Permalink
fix: showOpenFilePickerPolyfill wnow works in safari
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheeg committed Aug 9, 2024
1 parent 9fb3c15 commit 77259c1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions public/emu/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 77259c1

Please sign in to comment.