Skip to content

Commit

Permalink
Refactor #3447 - Fixed for Listbox component
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Jan 9, 2023
1 parent f6ebae9 commit a06547b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/listbox/Listbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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()"
>
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit a06547b

Please sign in to comment.