Refactor #3447 - Fixed for Listbox component

pull/3509/head
mertsincan 2023-01-09 12:19:04 +00:00
parent f6ebae9f17
commit a06547baec
1 changed files with 5 additions and 1 deletions

View File

@ -62,6 +62,7 @@
:aria-setsize="ariaSetSize" :aria-setsize="ariaSetSize"
:aria-posinset="getAriaPosInset(getOptionIndex(i, getItemOptions))" :aria-posinset="getAriaPosInset(getOptionIndex(i, getItemOptions))"
@click="onOptionSelect($event, option, getOptionIndex(i, getItemOptions))" @click="onOptionSelect($event, option, getOptionIndex(i, getItemOptions))"
@mousedown="onOptionMouseDown($event, getOptionIndex(i, getItemOptions))"
@mousemove="onOptionMouseMove($event, getOptionIndex(i, getItemOptions))" @mousemove="onOptionMouseMove($event, getOptionIndex(i, getItemOptions))"
@touchend="onOptionTouchEnd()" @touchend="onOptionTouchEnd()"
> >
@ -254,7 +255,7 @@ export default {
}, },
onListFocus(event) { onListFocus(event) {
this.focused = true; 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); this.$emit('focus', event);
}, },
onListBlur(event) { onListBlur(event) {
@ -332,6 +333,9 @@ export default {
this.optionTouched = false; this.optionTouched = false;
index !== -1 && (this.focusedOptionIndex = index); index !== -1 && (this.focusedOptionIndex = index);
}, },
onOptionMouseDown(event, index) {
this.changeFocusedOptionIndex(event, index);
},
onOptionMouseMove(event, index) { onOptionMouseMove(event, index) {
if (this.focusOnHover) { if (this.focusOnHover) {
this.changeFocusedOptionIndex(event, index); this.changeFocusedOptionIndex(event, index);