Merge pull request #1039 from Agastya18/feat/add-Escape-key
Docker Image CI / build-and-push-image (push) Waiting to run
Maintain Release Merge PR / update-release-pr (push) Waiting to run
release-please / release-please (push) Waiting to run
test / test (18.x) (push) Waiting to run
test / test (20.x) (push) Waiting to run
test / test (22.x) (push) Waiting to run

feat: add Escape key functionality to UIPrompt for closing the prompt
This commit is contained in:
Nariman Jelveh
2024-12-09 23:08:54 -08:00
committed by GitHub
+10
View File
@@ -81,6 +81,15 @@ function UIPrompt(options){
setTimeout(function(){
$(this_window).find('.prompt-input').get(0).focus({preventScroll:true});
}, 30);
// Add event listener for Escape key
$(document).on('keyup.uiprompt', function(e) {
if (e.key === 'Escape') {
resolve(false);
$(el_window).close();
$(document).off('keyup.uiprompt'); // Remove event listener
}
});
},
...options.window_options,
window_css:{
@@ -108,6 +117,7 @@ function UIPrompt(options){
resolve(false);
}
$(el_window).close();
$(document).off('keyup.uiprompt'); // Remove event listener
return false;
})