Skip to content

Commit

Permalink
Autocomplete: new option autoFocus, default false. Fixed #7032 - Auto…
Browse files Browse the repository at this point in the history
…complete: Add option to automatically highlight the first result
  • Loading branch information
rdworth committed Mar 15, 2011
1 parent 69ebdf4 commit 779df65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/unit/autocomplete/autocomplete_defaults.js
Expand Up @@ -4,6 +4,7 @@

var autocomplete_defaults = {
appendTo: "body",
autoFocus: false,
delay: 300,
disabled: false,
minLength: 1,
Expand Down
5 changes: 5 additions & 0 deletions ui/jquery.ui.autocomplete.js
Expand Up @@ -20,6 +20,7 @@ var requestIndex = 0;
$.widget( "ui.autocomplete", {
options: {
appendTo: "body",
autoFocus: false,
delay: 300,
minLength: 1,
position: {
Expand Down Expand Up @@ -359,6 +360,10 @@ $.widget( "ui.autocomplete", {
this.menu.deactivate();
this.menu.refresh();

if ( this.options.autoFocus ) {
this.menu.next( new $.Event("mouseover") );
}

// size and position menu
ul.show();
this._resizeMenu();
Expand Down

0 comments on commit 779df65

Please sign in to comment.