From 160bef30148ad5f80c98d73ba88fbb70ef7ffeac Mon Sep 17 00:00:00 2001 From: Howard Date: Wed, 21 Jun 2023 10:43:52 +0800 Subject: [PATCH] feat: added a new customizable property for aria-label --- docs/api/props.md | 13 +++++++++++++ src/components/Select.vue | 11 ++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/api/props.md b/docs/api/props.md index 0ee0f7b53..138249003 100644 --- a/docs/api/props.md +++ b/docs/api/props.md @@ -1,3 +1,16 @@ +## ariaLabel + +This value will be bound to the [aria-label +HTML attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label) +for the search input. Defaults to `Search for option`. + +```js +ariaLabel: { + type: String, + default: 'Search for option' +}, +``` + ## appendToBody Append the dropdown element to the end of the body diff --git a/src/components/Select.vue b/src/components/Select.vue index ca6f9d885..9ef6edee5 100644 --- a/src/components/Select.vue +++ b/src/components/Select.vue @@ -12,7 +12,7 @@ role="combobox" :aria-expanded="dropdownOpen.toString()" :aria-owns="`vs${uid}__listbox`" - aria-label="Search for option" + :aria-label="ariaLabel" v-click-outside="clickOutside" @mousedown="toggleDropdown($event)" > @@ -246,6 +246,15 @@ export default { default: false, }, + /** + * Sets the value of the 'aria-label' for the search ``. + * @type {String} + */ + ariaLabel: { + type: String, + default: 'Search for option', + }, + /** * Enable/disable filtering the options. * @type {Boolean}