summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2017-01-04 12:28:55 +0100
committerMartin Babinsky <mbabinsk@redhat.com>2017-02-17 17:50:32 +0100
commit6c6c68df544ac1046741d91dfdc59ef8d96b863c (patch)
tree45ea7d05c5a09aefb74feeb4fdd3af02f2a8999a
parent1a96e7f9e737941480436269668ccde0a50395f9 (diff)
downloadfreeipa-6c6c68df544ac1046741d91dfdc59ef8d96b863c.tar.gz
freeipa-6c6c68df544ac1046741d91dfdc59ef8d96b863c.tar.xz
freeipa-6c6c68df544ac1046741d91dfdc59ef8d96b863c.zip
WebUI: fix incorrect behavior of ESC button on combobox
When combobox is opened then ESC key should close it. There was a bug that ESC key closed also the dialog. It was caused by bad keyboard event handling. The CB was closed by keydown event and the dialog by keyup. Therefore the propagating of keyup and keydown event is stopped when CB is opened (when the event is fired on CB element). https://fedorahosted.org/freeipa/ticket/6388 Reviewed-By: Petr Vobornik <pvoborni@redhat.com> Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r--install/ui/src/freeipa/widget.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index 6ad8aadaf..15f012673 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -4611,7 +4611,7 @@ IPA.combobox_widget = function(spec) {
that.list_container = $('<div/>', {
'class': 'combobox-widget-list',
css: { 'z-index': that.z_index, 'display':'none' },
- keydown: that.on_list_container_keydown
+ keyup: that.on_list_container_keyup
}).appendTo(that.input_container);
var div = $('<div/>', {
@@ -4723,7 +4723,7 @@ IPA.combobox_widget = function(spec) {
}
};
- that.on_list_container_keydown = function(e) {
+ that.on_list_container_keyup = function(e) {
// close on ESCAPE and consume event to prevent unwanted
// behaviour like closing dialog
if (e.which == keys.ESCAPE) {
@@ -4756,11 +4756,16 @@ IPA.combobox_widget = function(spec) {
e.preventDefault();
that.select_next();
that.list.focus();
+ } else if (key === keys.ESCAPE) {
+ e.stopPropagation();
}
};
that.list_on_keydown = function(e) {
- if (e.which === keys.TAB) {
+ if (e.which === keys.ESCAPE) {
+ e.stopPropagation();
+ return false;
+ } else if (e.which === keys.TAB) {
e.preventDefault();
if (that.searchable) {
that.filter.focus();