mirror of
https://github.com/kiwix/kiwix-js.git
synced 2025-09-08 06:37:04 -04:00
Handle Enter key in Bootstrap modal dialogs (#864)
* Handle Enter key in Bootstrap modal dialogs Fixes #863 * Switch to native DOM methods, and keyup event
This commit is contained in:
parent
70273d71fe
commit
a57d6227d2
@ -73,6 +73,18 @@ define(rqDef, function(settingsStore) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user