diff --git a/src/components/multiselect/MultiSelect.vue b/src/components/multiselect/MultiSelect.vue index 0700e94e1..9c8ccb338 100755 --- a/src/components/multiselect/MultiSelect.vue +++ b/src/components/multiselect/MultiSelect.vue @@ -28,7 +28,7 @@ - +
@@ -420,6 +420,17 @@ export default { onOverlayEnter(el) { ZIndexUtils.set('overlay', el, this.$primevue.config.zIndex.overlay); this.alignOverlay(); + + if (!this.virtualScrollerDisabled) { + const selectedIndex = this.getSelectedOptionIndex(); + if (selectedIndex !== -1) { + setTimeout(() => { + this.virtualScroller && this.virtualScroller.scrollToIndex(selectedIndex) + }, 0); + } + } + }, + onOverlayAfterEnter() { this.bindOutsideClickListener(); this.bindScrollListener(); this.bindResizeListener(); @@ -428,13 +439,6 @@ export default { this.$refs.filterInput.focus(); } - if (!this.virtualScrollerDisabled) { - const selectedIndex = this.getSelectedOptionIndex(); - if (selectedIndex !== -1) { - this.virtualScroller.scrollToIndex(selectedIndex); - } - } - this.$emit('show'); }, onOverlayLeave() {