Fixed #1735 - TreeSelect should automatically scroll to show the selected option

pull/1751/head
Tuğçe Küçükoğlu 2021-11-10 17:28:19 +03:00
parent d849dea6f8
commit 089f315ced
1 changed files with 9 additions and 0 deletions

View File

@ -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: {