diff options
author | Richard Worth <rdworth@gmail.com> | 2011-03-15 05:43:19 -0400 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2011-03-15 05:43:19 -0400 |
commit | 779df6517d4e1bdd7ed3667537adb67c7443d15f (patch) | |
tree | 033cb13b8686976557fea5d225f9d29626359963 | |
parent | 69ebdf46a596de6e6889f9532fdad6ad841cc765 (diff) | |
download | jquery-ui-779df6517d4e1bdd7ed3667537adb67c7443d15f.tar.gz jquery-ui-779df6517d4e1bdd7ed3667537adb67c7443d15f.zip |
Autocomplete: new option autoFocus, default false. Fixed #7032 - Autocomplete: Add option to automatically highlight the first result
-rw-r--r-- | tests/unit/autocomplete/autocomplete_defaults.js | 1 | ||||
-rw-r--r-- | ui/jquery.ui.autocomplete.js | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/tests/unit/autocomplete/autocomplete_defaults.js b/tests/unit/autocomplete/autocomplete_defaults.js index fc92f3209..dd5007089 100644 --- a/tests/unit/autocomplete/autocomplete_defaults.js +++ b/tests/unit/autocomplete/autocomplete_defaults.js @@ -4,6 +4,7 @@ var autocomplete_defaults = { appendTo: "body", + autoFocus: false, delay: 300, disabled: false, minLength: 1, diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index a497b72fd..204322320 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -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(); |