don't close menu on enter, but submit input on enter in autocompletemenu if no menu item was selected
This commit is contained in:
parent
256c0cfa0d
commit
dc0c504809
2 changed files with 8 additions and 6 deletions
|
@ -482,7 +482,7 @@ Ox.Input = function(options, self) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function constructAutocompleteMenu() {
|
function constructAutocompleteMenu() {
|
||||||
var menu = Ox.Menu({
|
return Ox.Menu({
|
||||||
element: self.$input,
|
element: self.$input,
|
||||||
id: self.options.id + 'Menu', // fixme: we do this in other places ... are we doing it the same way? var name?,
|
id: self.options.id + 'Menu', // fixme: we do this in other places ... are we doing it the same way? var name?,
|
||||||
maxWidth: self.options.autocompleteSelectMaxWidth,
|
maxWidth: self.options.autocompleteSelectMaxWidth,
|
||||||
|
@ -490,13 +490,17 @@ Ox.Input = function(options, self) {
|
||||||
left: 4,
|
left: 4,
|
||||||
top: 0
|
top: 0
|
||||||
}
|
}
|
||||||
//size: self.options.size
|
|
||||||
})
|
})
|
||||||
.addClass('OxAutocompleteMenu')
|
.addClass('OxAutocompleteMenu')
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: clickMenu
|
click: clickMenu,
|
||||||
|
key_enter: function() {
|
||||||
|
if (self.$autocompleteMenu.is(':visible')) {
|
||||||
|
self.$autocompleteMenu.hideMenu();
|
||||||
|
submit();
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return menu;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function autovalidate() {
|
function autovalidate() {
|
||||||
|
|
|
@ -192,8 +192,6 @@ Ox.Menu = function(options, self) {
|
||||||
// called on key.enter
|
// called on key.enter
|
||||||
if (self.options.selected > -1) {
|
if (self.options.selected > -1) {
|
||||||
clickItem(self.options.selected);
|
clickItem(self.options.selected);
|
||||||
} else {
|
|
||||||
that.hideMenu();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue