Skip to content

Commit

Permalink
Remove unnecessary 'else', add 'lightboxModal' check
Browse files Browse the repository at this point in the history
  • Loading branch information
kaalibro committed Dec 11, 2023
1 parent cee1a40 commit 6513470
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,11 @@ document.addEventListener('keydown', function(e) {

if (isEsc) {
const globalPopup = document.querySelector('.global-popup');
if (!globalPopup || globalPopup.style.display === "none") {
const lightboxModal = document.querySelector('#lightboxModal');
if (!globalPopup || globalPopup.style.display === 'none') {
if (document.activeElement === lightboxModal) return;
interruptButton.click();
e.preventDefault();
} else {
if (!globalPopup) return;
globalPopup.style.display = "none";
}
}
});
Expand Down

0 comments on commit 6513470

Please sign in to comment.