Automatically focus first autocomplete result

In order to do this space-to-complete needs to be removed too since it
doesn't work together with autofocus. I think this is a good thing
anyway as it can cause accidental selections when typing. And we already
have two other shortcuts for this too (enter and tab).
This commit is contained in:
Toks
2014-04-28 15:07:09 -04:00
parent 22f2a76569
commit e84934bf78
2 changed files with 2 additions and 1 deletions

View File

@@ -46,6 +46,7 @@
$fields_multiple.autocomplete({ $fields_multiple.autocomplete({
delay: 100, delay: 100,
autoFocus: true,
focus: function() { focus: function() {
return false; return false;
}, },
@@ -148,6 +149,7 @@
$fields_single.autocomplete({ $fields_single.autocomplete({
minLength: 1, minLength: 1,
autoFocus: true,
source: function(req, resp) { source: function(req, resp) {
Danbooru.Autocomplete.normal_source(req.term, resp); Danbooru.Autocomplete.normal_source(req.term, resp);
} }

View File

@@ -116,7 +116,6 @@ $.widget( "ui.autocomplete", {
suppressKeyPress = true; suppressKeyPress = true;
this._keyEvent( "next", event ); this._keyEvent( "next", event );
break; break;
case keyCode.SPACE:
case keyCode.ENTER: case keyCode.ENTER:
case keyCode.NUMPAD_ENTER: case keyCode.NUMPAD_ENTER:
// when menu is open and has focus // when menu is open and has focus