Merge pull request #46 from Yohn/FileValidator-remove-file-bubbling-up

Prevent the FileValidator's remove button from bubbling up and closing modals when its within a modal.
This commit is contained in:
JWB 2025-01-19 01:19:40 -05:00 committed by GitHub
commit b4e4b87527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -94,7 +94,10 @@ class FileValidator {
const removeButton = document.createElement("button"); const removeButton = document.createElement("button");
removeButton.textContent = " "; removeButton.textContent = " ";
removeButton.className = "btn-file-rm"; 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); listItem.append(removeButton);