@@ -220,11 +220,7 @@ define(["../notjQuery"], function ($) {
220220 // If the suggestions are to be displayed due to a scripted event,
221221 // show them only if the completed input is still focused..
222222 if ( document . activeElement === input ) {
223- let options = suggestions . querySelectorAll ( '[type="button"]' ) ;
224- // ..and only if there are multiple options available
225- if ( options . length > 1 ) {
226- this . showSuggestions ( suggestions , input ) ;
227- }
223+ this . showSuggestions ( suggestions , input ) ;
228224 }
229225 } else {
230226 this . showSuggestions ( suggestions , input ) ;
@@ -313,7 +309,10 @@ define(["../notjQuery"], function ($) {
313309 activeElement = document . activeElement ;
314310 }
315311
316- return input === this . completedInput && this . termSuggestions . contains ( activeElement ) ;
312+ return input === this . completedInput && (
313+ ( ! activeElement && this . hasSuggestions ( ) )
314+ || ( activeElement && this . termSuggestions . contains ( activeElement ) )
315+ ) ;
317316 }
318317
319318 /**
@@ -334,12 +333,17 @@ define(["../notjQuery"], function ($) {
334333 }
335334
336335 let input = event . target ;
336+ let completedInput = this . completedInput ;
337337 this . suggestionKiller = setTimeout ( ( ) => {
338- if ( ! this . termSuggestions . contains ( document . activeElement ) ) {
338+ if ( completedInput !== this . completedInput ) {
339+ // Don't hide another input's suggestions
340+ } else if ( document . activeElement !== completedInput
341+ && ! this . termSuggestions . contains ( document . activeElement )
342+ ) {
339343 // Hide the suggestions if the user doesn't navigate them
340- if ( input !== this . completedInput ) {
344+ if ( input !== completedInput ) {
341345 // Restore input if a suggestion lost focus
342- this . suggest ( this . completedInput , this . completedValue ) ;
346+ this . suggest ( completedInput , this . completedValue ) ;
343347 }
344348
345349 this . hideSuggestions ( ) ;
0 commit comments