fix #5150
This commit is contained in:
Aresn 2019-01-07 14:30:47 +08:00 committed by GitHub
commit c6de66168c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View file

@ -37,4 +37,4 @@
} }
} }
}; };
</script> </script>

View file

@ -635,7 +635,21 @@
}, ANIMATION_TIMEOUT); }, ANIMATION_TIMEOUT);
}, },
onQueryChange(query) { onQueryChange(query) {
if (query.length > 0 && query !== this.query) this.visible = true; if (query.length > 0 && query !== this.query) {
// in 'AutoComplete', when set an initial value asynchronously,
// the 'dropdown list' should be stay hidden.
// [issue #5150]
if (this.autoComplete) {
let isInputFocused =
document.hasFocus &&
document.hasFocus() &&
document.activeElement === this.$el.querySelector('input');
this.visible = isInputFocused;
} else {
this.visible = true;
}
}
this.query = query; this.query = query;
this.unchangedQuery = this.visible; this.unchangedQuery = this.visible;
this.filterQueryChange = true; this.filterQueryChange = true;