mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 17:02:38 +00:00
Fixed #4881 - Listbox: select-on-focus causes a crash
This commit is contained in:
parent
75fb031fb4
commit
098c7a5128
1 changed files with 3 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue