Skip to content

Commit e082b2c

Browse files
committed
1 parent 709905d commit e082b2c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/components/Select.vue

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
v-append-to-body
9292
class="vs__dropdown-menu"
9393
role="listbox"
94+
:aria-multiselectable="multiple"
9495
tabindex="-1"
9596
@mousedown.prevent="onMousedown"
9697
@mouseup="onMouseUp"
@@ -109,7 +110,7 @@
109110
'vs__dropdown-option--highlight': index === typeAheadPointer,
110111
'vs__dropdown-option--disabled': !selectable(option),
111112
}"
112-
:aria-selected="index === typeAheadPointer ? true : null"
113+
:aria-selected="optionAriaSelected(option, index)"
113114
@mouseover="selectable(option) ? (typeAheadPointer = index) : null"
114115
@click.prevent.stop="selectable(option) ? select(option) : null"
115116
>
@@ -1212,6 +1213,24 @@ export default {
12121213
)
12131214
},
12141215
1216+
/**
1217+
* Determine the `aria-selected` value
1218+
* of an option
1219+
*
1220+
* @param {Object|String} option
1221+
* @param {Number} index
1222+
* @return {null|boolean}
1223+
*/
1224+
optionAriaSelected(option, index) {
1225+
if (!this.selectable(option)) {
1226+
return null
1227+
}
1228+
if (this.multiple) {
1229+
return this.isOptionSelected(option)
1230+
}
1231+
return index === this.typeAheadPointer ? true : null
1232+
},
1233+
12151234
/**
12161235
* Ensures that options are always
12171236
* passed as objects to scoped slots.

0 commit comments

Comments
 (0)