diff --git a/src/components/treeselect/TreeSelect.vue b/src/components/treeselect/TreeSelect.vue index 7e2143f9e..5b94a31a7 100644 --- a/src/components/treeselect/TreeSelect.vue +++ b/src/components/treeselect/TreeSelect.vue @@ -218,6 +218,7 @@ export default { this.bindOutsideClickListener(); this.bindScrollListener(); this.bindResizeListener(); + this.scrollValueInView(); this.$emit('show'); }, onOverlayLeave() { @@ -354,6 +355,14 @@ export default { this.expandedKeys[key] = true; } } + }, + scrollValueInView() { + if (this.overlay) { + let selectedItem = DomHandler.findSingle(this.overlay, 'li.p-highlight'); + if (selectedItem) { + selectedItem.scrollIntoView({ block: 'nearest', inline: 'start' }); + } + } } }, computed: {