@@ -73,6 +73,8 @@ define(function (require, exports, module) {
7373 * Number of pixels to position the popup below where $input is when constructor is called. Useful
7474 * if UI is going to animate position after construction, but QuickSearchField may receive input
7575 * before the animation is done.
76+ * @param {?number } options.firstHighlightIndex
77+ * Index of the result that is highlighted by default. null to not highlight any result.
7678 */
7779 function QuickSearchField ( $input , options ) {
7880 this . $input = $input ;
@@ -91,6 +93,9 @@ define(function (require, exports, module) {
9193
9294 $input . on ( "input" , this . _handleInput ) ;
9395 $input . on ( "keydown" , this . _handleKeyDown ) ;
96+
97+ // For search History this value is set to null
98+ this . _firstHighlightIndex = options . firstHighlightIndex ;
9499
95100 this . _dropdownTop = $input . offset ( ) . top + $input . height ( ) + ( options . verticalAdjust || 0 ) ;
96101 }
@@ -277,7 +282,11 @@ define(function (require, exports, module) {
277282 QuickSearchField . prototype . _render = function ( results , query ) {
278283 this . _displayedQuery = query ;
279284 this . _displayedResults = results ;
280- this . _highlightIndex = null ;
285+ if ( this . _firstHighlightIndex >= 0 ) {
286+ this . _highlightIndex = this . _firstHighlightIndex ;
287+ } else {
288+ this . _highlightIndex = null ;
289+ }
281290 // TODO: fixup to match prev value's item if possible?
282291
283292 if ( results . error || results . length === 0 ) {
0 commit comments