diff --git a/src/js/app.js b/src/js/app.js index 45651540..f1d04b8b 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -338,13 +338,18 @@ if (!iris.util.isMobile) { $(document).keyup(function(e) { if (e.key === "Escape") { // escape key maps to keycode `27` + if ($('#attachment-preview.gallery:visible').length) { + closeAttachmentsGallery(); + } else { closeAttachmentsPreview(); } + } }); function openAttachmentsPreview() { $('#floating-day-separator').remove(); var attachmentsPreview = $('#attachment-preview'); + attachmentsPreview.removeClass('gallery'); attachmentsPreview.empty(); var closeBtn = $('