From a06547baec7f169baeb3ffde7b02334716e17a52 Mon Sep 17 00:00:00 2001 From: mertsincan Date: Mon, 9 Jan 2023 12:19:04 +0000 Subject: [PATCH] Refactor #3447 - Fixed for Listbox component --- components/listbox/Listbox.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/listbox/Listbox.vue b/components/listbox/Listbox.vue index 83535cc2e..d96fb6200 100755 --- a/components/listbox/Listbox.vue +++ b/components/listbox/Listbox.vue @@ -62,6 +62,7 @@ :aria-setsize="ariaSetSize" :aria-posinset="getAriaPosInset(getOptionIndex(i, getItemOptions))" @click="onOptionSelect($event, option, getOptionIndex(i, getItemOptions))" + @mousedown="onOptionMouseDown($event, getOptionIndex(i, getItemOptions))" @mousemove="onOptionMouseMove($event, getOptionIndex(i, getItemOptions))" @touchend="onOptionTouchEnd()" > @@ -254,7 +255,7 @@ export default { }, onListFocus(event) { this.focused = true; - this.focusedOptionIndex = this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; + this.focusedOptionIndex = this.focusedOptionIndex !== -1 ? this.focusedOptionIndex : this.autoOptionFocus ? this.findFirstFocusedOptionIndex() : -1; this.$emit('focus', event); }, onListBlur(event) { @@ -332,6 +333,9 @@ export default { this.optionTouched = false; index !== -1 && (this.focusedOptionIndex = index); }, + onOptionMouseDown(event, index) { + this.changeFocusedOptionIndex(event, index); + }, onOptionMouseMove(event, index) { if (this.focusOnHover) { this.changeFocusedOptionIndex(event, index);