From 4bec7df33b01bcb356d131a55d2cce9fd8c22483 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Wed, 30 Oct 2019 10:42:06 +0000 Subject: [PATCH] Suppress Enter key presses in Alertify dialogues when the come from Select2 controls to allow item selection with Enter. Fixes #4610 --- docs/en_US/release_notes_4_15.rst | 1 + .../static/js/alertify.pgadmin.defaults.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/docs/en_US/release_notes_4_15.rst b/docs/en_US/release_notes_4_15.rst index 26af232b4..43028692d 100644 --- a/docs/en_US/release_notes_4_15.rst +++ b/docs/en_US/release_notes_4_15.rst @@ -27,6 +27,7 @@ Bug fixes | `Issue #4482 `_ - Ensure compression level is passed to pg_dump when backing up in directory format. | `Issue #4483 `_ - Ensure the number of jobs can be specified when backing up in directory format. | `Issue #4564 `_ - Ensure Javascript errors during Query Tool execution are reported as such and not as Ajax errors. +| `Issue #4610 `_ - Suppress Enter key presses in Alertify dialogues when the come from Select2 controls to allow item selection with Enter. | `Issue #4730 `_ - Ensure all messages are retained in the Query Tool from long running queries. | `Issue #4845 `_ - Fixed potential errorĀ in the properties dialog for the Code tab. | `Issue #4850 `_ - Fixed an issue where Datetimepicker control opens when clicking on the label. \ No newline at end of file diff --git a/web/pgadmin/static/js/alertify.pgadmin.defaults.js b/web/pgadmin/static/js/alertify.pgadmin.defaults.js index 592c1e566..954653d7b 100644 --- a/web/pgadmin/static/js/alertify.pgadmin.defaults.js +++ b/web/pgadmin/static/js/alertify.pgadmin.defaults.js @@ -463,5 +463,24 @@ define([ reverseButtons: true, }); + /* Suppress the enter key events occurring from select2 boxes + * so that the dialog does not close. + * Alertify listens to keyup events on the body element unfortunately + * instead of alertify dialog + */ + $('body').off('keyup').on('keyup', function(ev){ + if(ev.which === 13) { + let suppressForClasses = ['select2-selection', 'select2-search__field']; + let $el = $(ev.target); + for(let i=0; i