feat(components): [select] add aria-label to select's input (#13932)

* feat(components): [select] add aria-label to select's input

Select's input causes accessibility issues without aria-label, this commit adds it

* refactor(components): [select] change aria-label to label; update docs

* refactor(components): [select] change back to ariaLabel prop name

* docs(components): kebab-case for docs
This commit is contained in:
Karolis_Stoncius_Sneakybox 2023-08-24 16:03:01 +03:00 committed by GitHub
parent 268457135e
commit c29f6cc6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -163,6 +163,7 @@ select/value-key
| placement ^(2.2.17) | position of dropdown | ^[enum]`'top' \| 'top-start' \| 'top-end' \| 'bottom' \| 'bottom-start' \| 'bottom-end' \| 'left' \| 'left-start' \| 'left-end' \| 'right' \| 'right-start' \| 'right-end'` | bottom-start |
| max-collapse-tags ^(2.3.0) | the max tags number to be shown. To use this, `collapse-tags` must be true | ^[number] | 1 |
| popper-options | [popper.js](https://popper.js.org/docs/v2/) parameters | ^[object]refer to [popper.js](https://popper.js.org/docs/v2/) doc | {} |
| aria-label ^(a11y) | same as `aria-label` in native input | ^[string] | — |
:::warning

View File

@ -149,6 +149,7 @@
:disabled="selectDisabled"
:autocomplete="autocomplete"
:style="inputStyle"
:aria-label="ariaLabel"
@focus="handleFocus"
@blur="handleBlur"
@keyup="managePlaceholder"
@ -191,6 +192,7 @@
:validate-event="false"
:class="[nsSelect.is('focus', visible)]"
:tabindex="multiple && filterable ? -1 : undefined"
:label="ariaLabel"
@focus="handleFocus"
@blur="handleBlur"
@input="debouncedOnInputChange"
@ -526,6 +528,13 @@ export default defineComponent({
values: placements,
default: 'bottom-start',
},
/**
* @description native input aria-label
*/
ariaLabel: {
type: String,
default: undefined,
},
},
emits: [
UPDATE_MODEL_EVENT,