]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete: new option autoFocus, default false. Fixed #7032 - Autocomplete: Add...
authorRichard Worth <rdworth@gmail.com>
Tue, 15 Mar 2011 09:43:19 +0000 (05:43 -0400)
committerRichard Worth <rdworth@gmail.com>
Tue, 15 Mar 2011 09:43:19 +0000 (05:43 -0400)
tests/unit/autocomplete/autocomplete_defaults.js
ui/jquery.ui.autocomplete.js

index fc92f3209f529552928bb449bb7a93d205548049..dd5007089c630d95d218c4c991853059dde2736a 100644 (file)
@@ -4,6 +4,7 @@
 
 var autocomplete_defaults = {
        appendTo: "body",
+       autoFocus: false,
        delay: 300,
        disabled: false,
        minLength: 1,
index a497b72fda9c0b3b6ddd49c82f357a4f97d855bc..2043223202176f8d8255f6a0312222c631273e67 100644 (file)
@@ -20,6 +20,7 @@ var requestIndex = 0;
 $.widget( "ui.autocomplete", {
        options: {
                appendTo: "body",
+               autoFocus: false,
                delay: 300,
                minLength: 1,
                position: {
@@ -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();