Fix modal closing issue when clicking inside dialog

The modal was closing when clicking on input fields or trying to type
because the click event handler was checking if e.target.classList.contains('modal')
which could incorrectly trigger when clicking on certain elements.

Fixed by using closest() to properly detect if the click happened inside
a .modal-dialog element. The modal now only closes when clicking on the
backdrop (outside the dialog), not when interacting with form elements.
parent 7fc2d089
...@@ -758,8 +758,13 @@ function showAlert(message, type) { ...@@ -758,8 +758,13 @@ 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) {
if (e.target.classList.contains('modal')) { // Only close modal if clicking directly on the modal backdrop (not on dialog content)
e.target.classList.remove('show'); // 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');
} }
// 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