Fixed #4383 - OrderList and PickList: Getting error when empty field

This commit is contained in:
Tuğçe Küçükoğlu 2023-09-05 11:03:25 +03:00
parent 936f95783e
commit 001e22a262
2 changed files with 15 additions and 10 deletions

View file

@ -265,14 +265,17 @@ export default {
},
onListFocus(event, listType) {
const selectedFirstItem = DomHandler.findSingle(this.$refs[listType].$el, '[data-p-highlight="true"]');
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.$refs[listType].$el.children);
this.focused[listType] = true;
if (selectedFirstItem) {
const findIndex = ObjectUtils.findIndexInList(selectedFirstItem, this.$refs[listType].$el.children);
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
this.focused[listType] = true;
this.changeFocusedOptionIndex(index, listType);
this.$emit('focus', event);
const index = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : selectedFirstItem ? findIndex : -1;
this.changeFocusedOptionIndex(index, listType);
this.$emit('focus', event);
}
},
onListBlur(event, listType) {
this.focused[listType] = false;