Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Commit

Permalink
fix: dynamic completions
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianKienle committed Nov 12, 2019
1 parent 8abe2fe commit f54364c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/components/SearchInput/SearchInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ export default {
}
},
watch: {
// We observe the completions that currently match the predicate and if there are any matches
// and the input element is focused we show the completion list.
// TODO: Add tests
// TODO: Make activeElement and "isFocusedAndHasMatchingCompletions" reactive and
// bind the visibility of the completions list to isFocusedAndHasMatchingCompletions
completionsMatchingPredicate(completionsMatchingPredicate) {
if (completionsMatchingPredicate != null && completionsMatchingPredicate.length > 0) {
if (document.activeElement === this.$refs.input.$el) {
this.showCompletions();
}
}
},
predicate: {
immediate: true,
handler(newValue) {
Expand Down

0 comments on commit f54364c

Please sign in to comment.