Skip to content

Commit

Permalink
fix(VSelect): don't set scroll position on model change
Browse files Browse the repository at this point in the history
fixes #19635
closes #19642

reverts d65d586
reverts 2bb1c07
  • Loading branch information
KaelWD committed Apr 19, 2024
1 parent 674db98 commit 7d2991c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/vuetify/src/components/VSelect/VSelect.tsx
Expand Up @@ -250,6 +250,10 @@ export const VSelect = genericComponent<new <
const item = items.value.find(item => item.title.toLowerCase().startsWith(keyboardLookupPrefix))
if (item !== undefined) {
model.value = [item]
const index = displayItems.value.indexOf(item)
IN_BROWSER && window.requestAnimationFrame(() => {
index >= 0 && vVirtualScrollRef.value?.scrollToIndex(index)
})
}
}

Expand Down Expand Up @@ -302,9 +306,9 @@ export const VSelect = genericComponent<new <
}
}

watch([menu, model], () => {
watch(menu, () => {
if (!props.hideSelected && menu.value && model.value.length) {
const index = displayItems.value.findLastIndex(
const index = displayItems.value.findIndex(
item => model.value.some(s => props.valueComparator(s.value, item.value))
)
IN_BROWSER && window.requestAnimationFrame(() => {
Expand Down

0 comments on commit 7d2991c

Please sign in to comment.