Skip to content

Commit e7384e0

Browse files
authored
added event handler for escape (#802)
Signed-off-by: Shoumi <[email protected]>
1 parent 7edc4fc commit e7384e0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

mcpgateway/static/admin.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,17 @@ function openModal(modalId) {
536536
}
537537
}
538538

539+
// Global event handler for Escape key
540+
document.addEventListener("keydown", (event) => {
541+
if (event.key === "Escape") {
542+
// Find any active modal
543+
const activeModal = Array.from(AppState.activeModals)[0];
544+
if (activeModal) {
545+
closeModal(activeModal);
546+
}
547+
}
548+
});
549+
539550
function closeModal(modalId, clearId = null) {
540551
try {
541552
const modal = safeGetElement(modalId);

0 commit comments

Comments
 (0)