niki,
может так?
input.onkeydown = function (event) {
if (event.keyCode == 13) {
//save value
} else if (event.keyCode == 27) {
event.stopPropagation();
//input.blur();
let dialog = createYesDoDialog("Добавить домен " + input.value + "?",
function () {tryToSaveNewDomen(input)},
function () {initDomens()});
dialog.showModal();
}
};