From 63847028634f65fa55a9d293f84d2a28aa3e3d8e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 11 Nov 2020 12:47:26 +0100 Subject: [PATCH] fix file selector for IE11 --- src/platform/web/Platform.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/web/Platform.js b/src/platform/web/Platform.js index 6c28e95a..6a981c64 100644 --- a/src/platform/web/Platform.js +++ b/src/platform/web/Platform.js @@ -146,6 +146,7 @@ export class Platform { openFile(mimeType = null) { const input = document.createElement("input"); input.setAttribute("type", "file"); + input.className = "hidden"; if (mimeType) { input.setAttribute("accept", mimeType); } @@ -153,6 +154,7 @@ export class Platform { const checkFile = () => { input.removeEventListener("change", checkFile, true); const file = input.files[0]; + this._container.removeChild(input); if (file) { resolve({name: file.name, blob: BlobHandle.fromFile(file)}); } else { @@ -161,6 +163,8 @@ export class Platform { } input.addEventListener("change", checkFile, true); }); + // IE11 needs the input to be attached to the document + this._container.appendChild(input); input.click(); return promise; }