]> 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:39:56 +0000 (05:39 -0400)
committerRichard Worth <rdworth@gmail.com>
Tue, 15 Mar 2011 09:39:56 +0000 (05:39 -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 c83f042c0a7080708967c27ec5f4fffc0e30ed5e..e6acd4b637fc93c2308e1e73582eb5b4ea63346b 100644 (file)
@@ -22,6 +22,7 @@ $.widget( "ui.autocomplete", {
        defaultElement: "<input>",
        options: {
                appendTo: "body",
+               autoFocus: false,
                delay: 300,
                minLength: 1,
                position: {
@@ -362,6 +363,10 @@ $.widget( "ui.autocomplete", {
                this.menu.blur();
                this.menu.refresh();
 
+               if ( this.options.autoFocus ) {
+                       this.menu.next( new $.Event("mouseover") );
+               }
+
                // size and position menu
                ul.show();
                this._resizeMenu();