mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +03:00
add accessibility documentation (#867)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-select
|
||||
v-model="selected"
|
||||
:options="['Canada', 'United States']"
|
||||
:components="{Deselect}"
|
||||
/>
|
||||
@@ -10,6 +11,7 @@
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
selected: 'Canada',
|
||||
Deselect: {
|
||||
render: createElement => createElement('span', '❌'),
|
||||
},
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-select
|
||||
multiple
|
||||
v-model="selected"
|
||||
:options="['Canada', 'United States']"
|
||||
:components="{OpenIndicator}"
|
||||
/>
|
||||
@@ -12,9 +10,8 @@
|
||||
<script>
|
||||
export default {
|
||||
data: () => ({
|
||||
selected: ['Canada'],
|
||||
OpenIndicator: {
|
||||
render: createElement => createElement('span', {class: {'toggle': true}}),
|
||||
render: createElement => createElement('span', '🔽'),
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -93,7 +93,6 @@ module.exports = {
|
||||
['guide/install', 'Installation'],
|
||||
['guide/options', 'Dropdown Options'],
|
||||
['guide/values', 'Selecting Values'],
|
||||
['guide/localization', 'Localization'],
|
||||
['guide/upgrading', 'Upgrading 2.x to 3.x'],
|
||||
],
|
||||
},
|
||||
@@ -106,6 +105,14 @@ module.exports = {
|
||||
['guide/slots', 'Slots'],
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Accessibility',
|
||||
collapsable: false,
|
||||
children: [
|
||||
['guide/accessibility', 'WAI-ARIA Spec'],
|
||||
['guide/localization', 'Localization'],
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Digging Deeper',
|
||||
collapsable: false,
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
Vue Select aims to follow the WAI-ARIA best practices for the
|
||||
[combobox](https://www.w3.org/TR/wai-aria-practices-1.1/#combobox) and
|
||||
[listbox](https://www.w3.org/TR/wai-aria-practices-1.1/#Listbox) widgets.
|
||||
|
||||
The UX of the component isdesigned around the HTML `<select>` element, while following the WAI-ARIA
|
||||
specifications and best practices for creating accessible components.
|
||||
|
||||
## Combobox
|
||||
|
||||
- [WAI-ARIA Combobox - Best Practices](https://www.w3.org/TR/wai-aria-practices-1.1/#combobox)
|
||||
- [WAI-ARIA Combobox - Specification](https://www.w3.org/TR/wai-aria-1.1/#combobox)
|
||||
|
||||
## Listbox
|
||||
|
||||
- [WAI-ARIA Listbox - Best Practices](https://www.w3.org/TR/wai-aria-practices-1.1/#Listbox)
|
||||
|
||||
### Autocomplete
|
||||
|
||||
WAI-ARIA suggests four forms of autocomplete for Comboboxes. Vue Select can be configured to provide
|
||||
these use cases.
|
||||
|
||||
1. **No autocomplete**
|
||||
|
||||
> When the popup is triggered, the suggested values it contains are the same regardless of the
|
||||
characters typed in the textbox.
|
||||
|
||||
```html
|
||||
<v-select :filterable="false" :options="['No Autocomplete', 'List Autocomplete']" />
|
||||
```
|
||||
<v-select :filterable="false" :options="['No Autocomplete', 'List Autocomplete']" />
|
||||
|
||||
2. **List autocomplete with manual selection**
|
||||
|
||||
> When the popup is triggered, it presents suggested values that complete or logically
|
||||
correspond to the characters typed in the textbox. The character string the user has
|
||||
typed will become the value of the textbox unless the user selects a value in the popup.
|
||||
|
||||
```html
|
||||
<v-select taggable :options="['No Autocomplete', 'List Autocomplete']" />
|
||||
```
|
||||
<v-select taggable :options="['No Autocomplete', 'List Autocomplete']" />
|
||||
|
||||
3. **List autocomplete with automatic selection**
|
||||
|
||||
> When the popup is triggered, it presents suggested values that complete or logically
|
||||
correspond to the characters typed in the textbox, and the first suggestion is automatically
|
||||
highlighted as selected. The automatically selected suggestion becomes the value of the textbox
|
||||
when the combobox loses focus unless the user chooses a different suggestion or changes the
|
||||
character string in the textbox.
|
||||
|
||||
```html
|
||||
<v-select :options="['No Autocomplete', 'List Autocomplete']" />
|
||||
```
|
||||
<v-select :options="['No Autocomplete', 'List Autocomplete']" />
|
||||
|
||||
4. **List with inline autocomplete**
|
||||
|
||||
> This is the same as list with automatic selection with one additional feature. The portion of
|
||||
the selected suggestion that has not been typed by the user, a completion string, appears inline
|
||||
after the input cursor in the textbox. The inline completion string is visually highlighted and
|
||||
has a selected state.
|
||||
|
||||
🚧 Vue Select does not yet support this configuration, but it is on the roadmap
|
||||
[#865](https://github.com/sagalbot/vue-select/issues/865). 🚧
|
||||
@@ -1,8 +1,9 @@
|
||||
Vue Select utilizes child components throughout, and exposes an API to overwrite these components
|
||||
with your own, using the `components` `{Object}` prop. When implementing the `components` prop in
|
||||
your code, Vue Select merge it's default components with any keys that you set in the object.
|
||||
### Prop: `components` `{Object}`
|
||||
---
|
||||
|
||||
Your object will be merged with the object that is exported below:
|
||||
Vue Select utilizes child components throughout, and exposes an API to overwrite these components
|
||||
with your own, using the `components` `{Object}` prop. The object provided to the `components` prop
|
||||
will be merged with Vue Select's default components.
|
||||
|
||||
<<< @/src/components/childComponents.js{4-7}
|
||||
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
## RTL
|
||||
## Right to Left
|
||||
|
||||
vue-select supports RTL using the standard HTML API using the `dir` attribute.
|
||||
Vue Select supports RTL using the standard HTML API using the `dir` prop.
|
||||
|
||||
```html
|
||||
<v-select dir="rtl"></v-select>
|
||||
```
|
||||
|
||||
The `dir` attribute accepts the same values as the [HTML spec](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir): `rtl`,`ltr`, and `auto`.
|
||||
The `dir` prop accepts the same values as the [HTML spec](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/dir):
|
||||
|
||||
- `rtl`
|
||||
- `ltr`
|
||||
- `auto`
|
||||
|
||||
## Component Text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user