Skip to content

Commit

Permalink
resrtore close foo`s
Browse files Browse the repository at this point in the history
  • Loading branch information
TetiZ committed Feb 1, 2024
1 parent 481ad79 commit 95a4819
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/js/exersises.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,22 +616,16 @@ function dataToStorage(data) {

const modalBackDrop = document.querySelector('.pop-backdrop.is-open');

async function closeWithBackDrop(event) {
if (
event.target.classList.contains('pop-ex-close-btn') ||
event.key === 'Escape'
) {
await popUp(data);
modal.innerHTML = '';
modalBackDrop.classList.remove('is-open');
}
async function closeWithBackDrop() {
await popUp(data);
modal.innerHTML = '';
modalBackDrop.classList.remove('is-open');
}

if (modalBackDrop) {
modalBackDrop.addEventListener('click', closeWithBackDrop);

document.addEventListener('keydown', closeWithBackDrop);
}

window.addEventListener('keydown', function (e) {
if (e.key === 'Escape') {
modal.innerHTML = '';
Expand All @@ -643,7 +637,6 @@ function dataToStorage(data) {
}

const exPopClose = document.querySelector('.pop-ex-close-btn');

if (exPopClose) {
exPopClose.addEventListener('click', closeHandler);
} else {
Expand Down

0 comments on commit 95a4819

Please sign in to comment.