From 0ceee83950ff8ec7f288e4db168497c5b17d484b Mon Sep 17 00:00:00 2001 From: Rob Moen Date: Tue, 4 Dec 2012 10:49:15 -0800 Subject: [PATCH] If more than one title in suggestions match, select the first item. Addresses (Bug 42665) Change-Id: I8c425b79e34e931beb78538146a035c25023ce8a --- modules/jquery/jquery.multiSuggest.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/jquery/jquery.multiSuggest.js b/modules/jquery/jquery.multiSuggest.js index 4347ff3a81..ae628fa453 100644 --- a/modules/jquery/jquery.multiSuggest.js +++ b/modules/jquery/jquery.multiSuggest.js @@ -229,8 +229,11 @@ .css( 'whiteSpace', 'nowrap' ) .text( group.items[i] ) ); - // Select this item by default - if ( group.items[i].toLowerCase() === $input.val().toLowerCase() ) { + // Select the first item by default + if ( + $multiSuggest.find( '.selected' ).length === 0 && + group.items[i].toLowerCase() === $input.val().toLowerCase() ) + { $item.addClass( 'selected' ); } // CSS Ellipsis