Fixed autocomplete staying even after hiding input
This commit is contained in:
parent
b70231bd7e
commit
c0a5c800e0
1 changed files with 11 additions and 0 deletions
|
@ -24,6 +24,7 @@ App.Controls.AutoCompleteInput = function($input) {
|
||||||
var cachedSource = null;
|
var cachedSource = null;
|
||||||
var results = [];
|
var results = [];
|
||||||
var activeResult = -1;
|
var activeResult = -1;
|
||||||
|
var monitorInputHidingInterval = null;
|
||||||
|
|
||||||
if ($input.length === 0) {
|
if ($input.length === 0) {
|
||||||
throw new Error('Input element was not found');
|
throw new Error('Input element was not found');
|
||||||
|
@ -134,6 +135,7 @@ App.Controls.AutoCompleteInput = function($input) {
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
$div.hide();
|
$div.hide();
|
||||||
|
window.clearInterval(monitorInputHidingInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectPrevious() {
|
function selectPrevious() {
|
||||||
|
@ -232,6 +234,7 @@ App.Controls.AutoCompleteInput = function($input) {
|
||||||
top: ($input.offset().top + $input.outerHeight() - 2) + 'px',
|
top: ($input.offset().top + $input.outerHeight() - 2) + 'px',
|
||||||
});
|
});
|
||||||
$div.show();
|
$div.show();
|
||||||
|
monitorInputHiding();
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshActiveResult() {
|
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;
|
return options;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue