Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Autocomplete: new option autoFocus, default false. Fixed #7032 - Auto…

…complete: Add option to automatically highlight the first result
  • Loading branch information...
commit 779df6517d4e1bdd7ed3667537adb67c7443d15f 1 parent 69ebdf4
Richard D. Worth authored March 15, 2011
1  tests/unit/autocomplete/autocomplete_defaults.js
@@ -4,6 +4,7 @@
4 4
 
5 5
 var autocomplete_defaults = {
6 6
 	appendTo: "body",
  7
+	autoFocus: false,
7 8
 	delay: 300,
8 9
 	disabled: false,
9 10
 	minLength: 1,
5  ui/jquery.ui.autocomplete.js
@@ -20,6 +20,7 @@ var requestIndex = 0;
20 20
 $.widget( "ui.autocomplete", {
21 21
 	options: {
22 22
 		appendTo: "body",
  23
+		autoFocus: false,
23 24
 		delay: 300,
24 25
 		minLength: 1,
25 26
 		position: {
@@ -359,6 +360,10 @@ $.widget( "ui.autocomplete", {
359 360
 		this.menu.deactivate();
360 361
 		this.menu.refresh();
361 362
 
  363
+		if ( this.options.autoFocus ) {
  364
+			this.menu.next( new $.Event("mouseover") );
  365
+		}
  366
+
362 367
 		// size and position menu
363 368
 		ul.show();
364 369
 		this._resizeMenu();

0 notes on commit 779df65

Please sign in to comment.
Something went wrong with that request. Please try again.