Add keyboard handling to System Alert

Former-commit-id: a9c8966ca096385e9f61141817f812854d26fb72 [formerly 285cd265dca65028c3bcefd6e393cbbf2c1c316e [formerly 26e90368a2413894c762c0fa788ae5b489df18ab]]
Former-commit-id: fc3d5d47a0b747590d5dbc56eafb9f601b8cda70 [formerly 51a483a7a6f53b236f2ceec03ed180d71c44a4da]
Former-commit-id: 642183c6ea27a5ba9d8f2992b67e0aad205e5eda
This commit is contained in:
Jaifroid 2022-06-03 08:33:28 +01:00
parent 53cda7f516
commit 7c44ae5e3a

View File

@ -656,6 +656,18 @@ define(rqDef, function(util) {
resolve(false);
}
});
document.getElementById('alertModal').addEventListener('keyup', function (e) {
if (/Enter/.test(e.key)) {
// We need to focus before clicking the button, because the handler above is based on document.activeElement
if (isConfirm) {
document.getElementById('approveConfirm').focus();
document.getElementById('approveConfirm').click();
} else {
document.getElementById('closeMessage').focus();
document.getElementById('closeMessage').click();
}
}
});
});
}