Fixed #1516 - Dropdown with filter bug selecting with arrow keys

pull/1544/head
mertsincan 2021-09-14 13:42:01 +03:00
parent 121054cc67
commit 6df9d4e461
1 changed files with 5 additions and 5 deletions

View File

@ -206,20 +206,20 @@ export default {
},
getSelectedOption() {
let index = this.getSelectedOptionIndex();
return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.options[index.group])[index.option]: this.options[index]) : null;
return index !== -1 ? (this.optionGroupLabel ? this.getOptionGroupChildren(this.visibleOptions[index.group])[index.option]: this.visibleOptions[index]) : null;
},
getSelectedOptionIndex() {
if (this.modelValue != null && this.options) {
if (this.modelValue != null && this.visibleOptions) {
if (this.optionGroupLabel) {
for (let i = 0; i < this.options.length; i++) {
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.options[i]));
for (let i = 0; i < this.visibleOptions.length; i++) {
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.visibleOptions[i]));
if (selectedOptionIndex !== -1) {
return {group: i, option: selectedOptionIndex};
}
}
}
else {
return this.findOptionIndexInList(this.modelValue, this.options);
return this.findOptionIndexInList(this.modelValue, this.visibleOptions);
}
}