diff --git a/src/mixins/optionMixin.js b/src/mixins/optionMixin.js index f70d5c94..6ada1e0c 100644 --- a/src/mixins/optionMixin.js +++ b/src/mixins/optionMixin.js @@ -61,7 +61,7 @@ export default { }), setCurrentHighlightedOption() { - this.instance.setCurrentHighlightedOption(this.node) + this.instance.setCurrentHighlightedOption(this.node, false) }, }, } diff --git a/src/mixins/treeselectMixin.js b/src/mixins/treeselectMixin.js index 28ef6504..1192fe88 100644 --- a/src/mixins/treeselectMixin.js +++ b/src/mixins/treeselectMixin.js @@ -1171,13 +1171,15 @@ export default { return true }, - setCurrentHighlightedOption(node) { + setCurrentHighlightedOption(node, scroll = true) { if (!node) return this.menu.current = node.id - const $option = this.$el.querySelector(`.vue-treeselect__option[data-id="${node.id}"]`) - if ($option) scrollIntoView(this.$refs.menu, $option) + if (scroll) { + const $option = this.$el.querySelector(`.vue-treeselect__option[data-id="${node.id}"]`) + if ($option) scrollIntoView(this.$refs.menu, $option) + } }, resetHighlightedOptionWhenNecessary(forceReset = false) {