Skip to content

Commit 40d82dc

Browse files
authored
fix(Combobox): highlight element for async options (#2290)
* fix highlighting element * get oldValue
1 parent 4ae5bcf commit 40d82dc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/core/src/Combobox/ComboboxInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ watch(rootContext.modelValue, async () => {
9696
resetSearchTerm()
9797
}, { immediate: true, deep: true })
9898
99-
watch(rootContext.filterState, () => {
99+
watch(rootContext.filterState, (_newValue, oldValue) => {
100100
// we exclude virtualized list as the state would be constantly updated,
101-
// and only change highlight when there is no highlighted item
102-
if (!rootContext.isVirtual.value && !rootContext.highlightedElement.value) {
101+
// and only change highlight when previously there were no items displayed
102+
if (!rootContext.isVirtual.value && (oldValue.count === 0)) {
103103
listboxContext.highlightFirstItem()
104104
}
105105
})

0 commit comments

Comments
 (0)