Skip to content

Commit

Permalink
Merge pull request trongate#96 from DaFa66/master
Browse files Browse the repository at this point in the history
Awesome as always.  Thank you!
  • Loading branch information
trongate authored Jul 21, 2022
2 parents 4510aec + 18900af commit 6b9eec3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
15 changes: 14 additions & 1 deletion public/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ function closeModal() {
overlay.remove();
}

function attemptEscCloseModal () {
document.onkeydown = function (e) {

var modalContainer = _("modal-container");

if ((e.key == "Escape") && (modalContainer)) {
closeModal();
}
};
}

function fetchAssociatedRecords(relationName, updateId) {

var params = {
Expand Down Expand Up @@ -434,4 +445,6 @@ body.addEventListener('click', (ev) => {
closeSlideNav();
}
}
});
});

attemptEscCloseModal ();
14 changes: 13 additions & 1 deletion public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ function closeModal() {
overlay.remove();
}

function attemptEscCloseModal () {
document.onkeydown = function (e) {

var modalContainer = _("modal-container");

if ((e.key == "Escape") && (!modalContainer)) {
closeModal();
}
};
}

var slideNavLinks = document.querySelector("#slide-nav ul");

if (slideNavLinks !== null) {
Expand All @@ -102,5 +113,6 @@ if (slideNavLinks !== null) {
}
}
});
}

}
attemptEscCloseModal ();

0 comments on commit 6b9eec3

Please sign in to comment.