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) { ...@@ -758,13 +758,10 @@ function showAlert(message, type) {
// Event listeners for token action buttons // Event listeners for token action buttons
document.addEventListener('click', function(e) { document.addEventListener('click', function(e) {
// Only close modal if clicking directly on the modal backdrop (not on dialog content) // Only close modal if clicking directly on the modal backdrop element itself
// Use closest() to check if click happened inside a modal-dialog // e.target is the actual element clicked - if it's the modal, the click was on the backdrop
const clickedModal = e.target.closest('.modal'); if (e.target.classList.contains('modal') && e.target.classList.contains('show')) {
const clickedDialog = e.target.closest('.modal-dialog'); e.target.classList.remove('show');
if (clickedModal && !clickedDialog) {
clickedModal.classList.remove('show');
} }
// Handle revoke token button clicks // 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