From bc0da15d205a3df8d6faa9200344c9128aec4834 Mon Sep 17 00:00:00 2001 From: Corentin Flr <10946971+cogk@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:59:39 +0100 Subject: [PATCH] fix(capture): Add input to DOM before emitting click on it (#24841) --- frappe/public/js/frappe/ui/capture.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frappe/public/js/frappe/ui/capture.js b/frappe/public/js/frappe/ui/capture.js index 1d40f50485..aeca245857 100644 --- a/frappe/public/js/frappe/ui/capture.js +++ b/frappe/public/js/frappe/ui/capture.js @@ -31,6 +31,10 @@ function get_file_input() { input.setAttribute("accept", "image/*"); input.setAttribute("multiple", ""); + // Make sure that the input exists in the DOM + input.classList.add("visually-hidden"); + document.body.appendChild(input); + return input; } @@ -126,6 +130,10 @@ frappe.ui.Capture = class { me.images.push(f); } + // Remove the input from the DOM + me.input.remove(); + me.input = null; + me.render_preview(); me.dialog.show(); };