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:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user