From 30e77106884b76a634e153f25413979c752b3f24 Mon Sep 17 00:00:00 2001 From: Yohn Date: Sun, 19 Jan 2025 01:15:31 -0500 Subject: [PATCH] Prevent the FileValidator's remove button from bubbling up and closing modals when its within a modal. --- docs/js/FileValidator.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/js/FileValidator.js b/docs/js/FileValidator.js index 0962b311..70d4d95a 100644 --- a/docs/js/FileValidator.js +++ b/docs/js/FileValidator.js @@ -94,7 +94,10 @@ class FileValidator { const removeButton = document.createElement("button"); removeButton.textContent = " "; removeButton.className = "btn-file-rm"; - removeButton.addEventListener("click", () => this.removeFile(file, listItem)); + removeButton.addEventListener("click", (event) => { + event.stopPropagation(); // Prevent event from bubbling up to modal + this.removeFile(file, listItem); + }); listItem.append(removeButton);