Skip to content

Commit 8c0e2bc

Browse files
authored
fix(VCombobox): re-compute menu items before setting index (#13825)
fixes #12567
1 parent 235bf94 commit 8c0e2bc

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

Diff for: packages/vuetify/src/components/VSelect/VSelect.ts

+7-11
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,6 @@ export default baseMixins.extend<options>().extend({
658658
const keyCode = e.keyCode
659659
const menu = this.$refs.menu
660660

661-
// If enter, space, open menu
662-
if ([
663-
keyCodes.enter,
664-
keyCodes.space,
665-
].includes(keyCode)) this.activateMenu()
666-
667661
this.$emit('keydown', e)
668662

669663
if (!menu) return
@@ -677,6 +671,12 @@ export default baseMixins.extend<options>().extend({
677671
})
678672
}
679673

674+
// If enter, space, open menu
675+
if ([
676+
keyCodes.enter,
677+
keyCodes.space,
678+
].includes(keyCode)) this.activateMenu()
679+
680680
// If menu is not active, up/down/home/end can do
681681
// one of 2 things. If multiple, opens the
682682
// menu, if not, will cycle through all
@@ -709,6 +709,7 @@ export default baseMixins.extend<options>().extend({
709709
if (!menu || !this.isDirty) return
710710

711711
// When menu opens, set index of first active item
712+
this.$refs.menu.getTiles()
712713
for (let i = 0; i < menu.tiles.length; i++) {
713714
if (menu.tiles[i].getAttribute('aria-selected') === 'true') {
714715
this.setMenuIndex(i)
@@ -839,11 +840,6 @@ export default baseMixins.extend<options>().extend({
839840
(this.$refs.menu as { [key: string]: any }).updateDimensions()
840841
})
841842

842-
// We only need to reset list index for multiple
843-
// to keep highlight when an item is toggled
844-
// on and off
845-
if (!this.multiple) return
846-
847843
const listIndex = this.getMenuIndex()
848844

849845
this.setMenuIndex(-1)

0 commit comments

Comments
 (0)