Fix modal closing issue - check e.target directly

The previous fix using closest() was incorrect because closest('.modal')
would always return the modal for any click inside it (including dialog).

The correct approach is to check if e.target IS the modal element itself,
which only happens when clicking directly on the backdrop overlay,
not when clicking on elements inside the dialog.
parent 7bc3a49b
......@@ -758,13 +758,10 @@ function showAlert(message, type) {
// Event listeners for token action buttons
document.addEventListener('click', function(e) {
// Only close modal if clicking directly on the modal backdrop (not on dialog content)
// Use closest() to check if click happened inside a modal-dialog
const clickedModal = e.target.closest('.modal');
const clickedDialog = e.target.closest('.modal-dialog');
if (clickedModal && !clickedDialog) {
clickedModal.classList.remove('show');
// Only close modal if clicking directly on the modal backdrop element itself
// e.target is the actual element clicked - if it's the modal, the click was on the backdrop
if (e.target.classList.contains('modal') && e.target.classList.contains('show')) {
e.target.classList.remove('show');
}
// Handle revoke token button clicks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment