diff --git a/public_html/js/Controls/AutoCompleteInput.js b/public_html/js/Controls/AutoCompleteInput.js index 46b3d063..27bc20ad 100644 --- a/public_html/js/Controls/AutoCompleteInput.js +++ b/public_html/js/Controls/AutoCompleteInput.js @@ -24,6 +24,7 @@ App.Controls.AutoCompleteInput = function($input) { var cachedSource = null; var results = []; var activeResult = -1; + var monitorInputHidingInterval = null; if ($input.length === 0) { throw new Error('Input element was not found'); @@ -134,6 +135,7 @@ App.Controls.AutoCompleteInput = function($input) { function hide() { $div.hide(); + window.clearInterval(monitorInputHidingInterval); } function selectPrevious() { @@ -232,6 +234,7 @@ App.Controls.AutoCompleteInput = function($input) { top: ($input.offset().top + $input.outerHeight() - 2) + 'px', }); $div.show(); + monitorInputHiding(); } function refreshActiveResult() { @@ -241,5 +244,13 @@ App.Controls.AutoCompleteInput = function($input) { } } + function monitorInputHiding() { + monitorInputHidingInterval = window.setInterval(function() { + if (!$input.is(':visible')) { + hide(); + } + }, 100); + } + return options; };