Fixed #4881 - Listbox: select-on-focus causes a crash
parent
75fb031fb4
commit
098c7a5128
|
@ -228,6 +228,7 @@ export default {
|
||||||
onListFocus(event) {
|
onListFocus(event) {
|
||||||
this.focused = true;
|
this.focused = true;
|
||||||
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1;
|
||||||
|
this.autoUpdateModel();
|
||||||
this.$emit('focus', event);
|
this.$emit('focus', event);
|
||||||
},
|
},
|
||||||
onListBlur(event) {
|
onListBlur(event) {
|
||||||
|
@ -327,7 +328,7 @@ export default {
|
||||||
let metaSelection = this.optionTouched ? false : this.metaKeySelection;
|
let metaSelection = this.optionTouched ? false : this.metaKeySelection;
|
||||||
|
|
||||||
if (metaSelection) {
|
if (metaSelection) {
|
||||||
let metaKey = event.metaKey || event.ctrlKey;
|
let metaKey = event && (event.metaKey || event.ctrlKey);
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
if (metaKey) {
|
if (metaKey) {
|
||||||
|
@ -632,7 +633,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoUpdateModel() {
|
autoUpdateModel() {
|
||||||
if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption && !this.multiple) {
|
if (this.selectOnFocus && this.autoOptionFocus && !this.hasSelectedOption && !this.multiple && this.focused) {
|
||||||
this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
|
this.focusedOptionIndex = this.findFirstFocusedOptionIndex();
|
||||||
this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex]);
|
this.onOptionSelect(null, this.visibleOptions[this.focusedOptionIndex]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue