Enforce same keyboard behaviour as tryton
- down key put the focus on the menu - return key does not open the menu - escape key does not close modal issue7296 review37181002
This commit is contained in:
1 parent
11486416c4
commit
7defe1ddff
2 files changed
+21
-3
No files matched your search
+13
-3
@@ -3063,14 +3063,24 @@
|
||||
this.input.keydown(function(evt) {
|
||||
if (evt.which == Sao.common.ESC_KEYCODE) {
|
||||
if (this.dropdown.hasClass('open')) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
this.menu.dropdown('toggle');
|
||||
}
|
||||
} else if (evt.which == Sao.common.RETURN_KEYCODE) {
|
||||
if (!this.dropdown.hasClass('open')) {
|
||||
this.menu.dropdown('toggle');
|
||||
} else if (evt.which == Sao.common.DOWN_KEYCODE) {
|
||||
if (this.dropdown.hasClass('open')) {
|
||||
evt.preventDefault();
|
||||
this.menu.find('li > a').first().focus();
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
this.menu.keydown(function(evt) {
|
||||
if (evt.which == Sao.common.ESC_KEYCODE) {
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
this.menu.dropdown('toggle');
|
||||
}
|
||||
}.bind(this));
|
||||
// We must set the overflow of the treeview containing the input to
|
||||
// visible to prevent vertical scrollbar inherited from the auto
|
||||
// overflow-x
|
||||
|
||||
@@ -607,6 +607,14 @@ var Sao = {};
|
||||
this.update.bind(this),
|
||||
this.match_selected.bind(this),
|
||||
this.format.bind(this));
|
||||
completion.input.keydown(function(evt) {
|
||||
if (evt.which == Sao.common.RETURN_KEYCODE) {
|
||||
if (!completion.dropdown.hasClass('open')) {
|
||||
evt.preventDefault();
|
||||
completion.menu.dropdown('toggle');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
format: function(content) {
|
||||
var el = jQuery('<div/>');
|
||||
|
||||
Reference in new issue
Block a user