fix(select): auto focus option in autoUpdateModel
This makes sure that the first option gets focused after the select is open and also if the options are changes in cases where the options are being loaded and passed to the select at a later point.pull/7282/head
parent
d71183fcc4
commit
6d8aa45167
|
@ -686,7 +686,7 @@ export default {
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.autoFilterFocus && this.filter && focus(this.$refs.filterInput.$el);
|
this.autoFilterFocus && this.filter && focus(this.$refs.filterInput.$el);
|
||||||
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : this.editable ? -1 : this.findSelectedOptionIndex();
|
this.autoUpdateModel();
|
||||||
}, 1);
|
}, 1);
|
||||||
},
|
},
|
||||||
onOverlayAfterEnter() {
|
onOverlayAfterEnter() {
|
||||||
|
@ -900,8 +900,11 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
autoUpdateModel() {
|
autoUpdateModel() {
|
||||||
if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) {
|
if (this.autoOptionFocus) {
|
||||||
this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
|
this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.selectOnFocus && this.autoOptionFocus && !this.$filled) {
|
||||||
this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex], false);
|
this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex], false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue