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() { getSelectedOption() {
let index = this.getSelectedOptionIndex(); 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() { getSelectedOptionIndex() {
if (this.modelValue != null && this.options) { if (this.modelValue != null && this.visibleOptions) {
if (this.optionGroupLabel) { if (this.optionGroupLabel) {
for (let i = 0; i < this.options.length; i++) { for (let i = 0; i < this.visibleOptions.length; i++) {
let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.options[i])); let selectedOptionIndex = this.findOptionIndexInList(this.modelValue, this.getOptionGroupChildren(this.visibleOptions[i]));
if (selectedOptionIndex !== -1) { if (selectedOptionIndex !== -1) {
return {group: i, option: selectedOptionIndex}; return {group: i, option: selectedOptionIndex};
} }
} }
} }
else { else {
return this.findOptionIndexInList(this.modelValue, this.options); return this.findOptionIndexInList(this.modelValue, this.visibleOptions);
} }
} }