window.addEventListener("keydown", function(e) {
if (e.keyCode == 27) {
popup.remove('popup_active');
}
}, true)
window.addEventListener("keydown", function(e) {
if (e.keyCode == 27) {
popup.classList.toggle('popup_active');
}
}, true);
window.addEventListener("keydown", function(e) {
if (e.keyCode == 27 && popup.classList.contains('popup_active')) {
popup.classList.remove('popup_active');
}
}, true);