@@ -45,6 +45,12 @@ const props = withDefaults(
4545 * JavaScript, instead of using CSS absolute & relative positioning.
4646 */
4747 teleport? : string ;
48+ /**
49+ * ARIA attributes to describe the select component. This is useful for accessibility.
50+ */
51+ aria? : {
52+ labelledby? : string ;
53+ };
4854 /**
4955 * A function to get the label of an option. By default, it assumes the option is an
5056 * object with a `label` property. Used to display the selected option in the input &
@@ -70,6 +76,7 @@ const props = withDefaults(
7076 isMulti: false ,
7177 closeOnSelect: true ,
7278 teleport: undefined ,
79+ aria: undefined ,
7380 getOptionLabel : (option : Option ) => option .label ,
7481 getMultiValueLabel : (option : Option ) => option .label ,
7582 },
@@ -261,7 +268,10 @@ onBeforeUnmount(() => {
261268 :class =" { multi: isMulti }"
262269 role =" combobox"
263270 :aria-expanded =" menuOpen"
264- :aria-label =" placeholder"
271+ :aria-describedby =" placeholder"
272+ :aria-description =" placeholder"
273+ :aria-labelledby =" aria?.labelledby"
274+ :aria-label =" selectedOptions.length ? selectedOptions.map(getOptionLabel).join(', ') : ''"
265275 >
266276 <div
267277 v-if =" !props.isMulti && selectedOptions[0]"
@@ -336,6 +346,9 @@ onBeforeUnmount(() => {
336346 <div
337347 v-if =" menuOpen"
338348 class =" menu"
349+ role =" listbox"
350+ :aria-label =" aria?.labelledby"
351+ :aria-multiselectable =" isMulti"
339352 :style =" {
340353 width: props.teleport ? `${container?.getBoundingClientRect().width}px` : '100%',
341354 top: props.teleport ? calculateMenuPosition().top : 'unset',
0 commit comments