Skip to content

Commit b4e4b87

Browse files
authored
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.
2 parents db3dc3b + 30e7710 commit b4e4b87

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/js/FileValidator.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ class FileValidator {
9494
const removeButton = document.createElement("button");
9595
removeButton.textContent = " ";
9696
removeButton.className = "btn-file-rm";
97-
removeButton.addEventListener("click", () => this.removeFile(file, listItem));
97+
removeButton.addEventListener("click", (event) => {
98+
event.stopPropagation(); // Prevent event from bubbling up to modal
99+
this.removeFile(file, listItem);
100+
});
98101

99102
listItem.append(removeButton);
100103

0 commit comments

Comments
 (0)