@vaadin/select 24.0.5 → 24.1.0-alpha10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,7 +30,7 @@ A web component for selecting a single value from a list of options presented in
30
30
  </script>
31
31
  ```
32
32
 
33
- [<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/select/screenshot.png" width="231" alt="Screenshot of vaadin-select">](https://vaadin.com/docs/latest/components/select)
33
+ [<img src="https://raw.githubusercontent.com/vaadin/web-components/main/packages/select/screenshot.png" width="231" alt="Screenshot of vaadin-select">](https://vaadin.com/docs/latest/components/select)
34
34
 
35
35
  ## Installation
36
36
 
@@ -49,7 +49,7 @@ import '@vaadin/select';
49
49
  ## Themes
50
50
 
51
51
  Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
52
- The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/select/vaadin-select.js) of the package uses the Lumo theme.
52
+ The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/select/vaadin-select.js) of the package uses the Lumo theme.
53
53
 
54
54
  To use the Material theme, import the component from the `theme/material` folder:
55
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/select",
3
- "version": "24.0.5",
3
+ "version": "24.1.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,17 +38,18 @@
38
38
  ],
39
39
  "dependencies": {
40
40
  "@polymer/polymer": "^3.2.0",
41
- "@vaadin/button": "~24.0.5",
42
- "@vaadin/component-base": "~24.0.5",
43
- "@vaadin/field-base": "~24.0.5",
44
- "@vaadin/input-container": "~24.0.5",
45
- "@vaadin/item": "~24.0.5",
46
- "@vaadin/list-box": "~24.0.5",
47
- "@vaadin/lit-renderer": "~24.0.5",
48
- "@vaadin/overlay": "~24.0.5",
49
- "@vaadin/vaadin-lumo-styles": "~24.0.5",
50
- "@vaadin/vaadin-material-styles": "~24.0.5",
51
- "@vaadin/vaadin-themable-mixin": "~24.0.5"
41
+ "@vaadin/a11y-base": "24.1.0-alpha10",
42
+ "@vaadin/button": "24.1.0-alpha10",
43
+ "@vaadin/component-base": "24.1.0-alpha10",
44
+ "@vaadin/field-base": "24.1.0-alpha10",
45
+ "@vaadin/input-container": "24.1.0-alpha10",
46
+ "@vaadin/item": "24.1.0-alpha10",
47
+ "@vaadin/list-box": "24.1.0-alpha10",
48
+ "@vaadin/lit-renderer": "24.1.0-alpha10",
49
+ "@vaadin/overlay": "24.1.0-alpha10",
50
+ "@vaadin/vaadin-lumo-styles": "24.1.0-alpha10",
51
+ "@vaadin/vaadin-material-styles": "24.1.0-alpha10",
52
+ "@vaadin/vaadin-themable-mixin": "24.1.0-alpha10"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@esm-bundle/chai": "^4.3.4",
@@ -60,5 +61,5 @@
60
61
  "web-types.json",
61
62
  "web-types.lit.json"
62
63
  ],
63
- "gitHead": "e384c1b5c02e01a4382a433f727d075de9a4ee97"
64
+ "gitHead": "12e39be7eb3b49c68708e8ca3de2fb22e91051a1"
64
65
  }
@@ -3,9 +3,9 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
6
7
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
8
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
- import { ListMixin } from '@vaadin/component-base/src/list-mixin.js';
9
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
10
 
11
11
  /**
@@ -4,9 +4,9 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
+ import { ListMixin } from '@vaadin/a11y-base/src/list-mixin.js';
7
8
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
9
  import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
9
- import { ListMixin } from '@vaadin/component-base/src/list-mixin.js';
10
10
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
11
 
12
12
  /**
@@ -14,6 +14,11 @@ registerStyles(
14
14
  align-items: flex-start;
15
15
  justify-content: flex-start;
16
16
  }
17
+ @media (forced-colors: active) {
18
+ [part='overlay'] {
19
+ outline: 3px solid;
20
+ }
21
+ }
17
22
  `,
18
23
  { moduleId: 'vaadin-select-overlay-styles' },
19
24
  );
@@ -3,10 +3,10 @@
3
3
  * Copyright (c) 2017 - 2023 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
6
+ import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
7
+ import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
7
8
  import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
8
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
- import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
10
10
  import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
11
11
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
12
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -9,23 +9,27 @@ import './vaadin-select-list-box.js';
9
9
  import './vaadin-select-overlay.js';
10
10
  import './vaadin-select-value-button.js';
11
11
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
12
- import { DelegateFocusMixin } from '@vaadin/component-base/src/delegate-focus-mixin.js';
12
+ import { setAriaIDReference } from '@vaadin/a11y-base/src/aria-id-reference.js';
13
+ import { DelegateFocusMixin } from '@vaadin/a11y-base/src/delegate-focus-mixin.js';
14
+ import { KeyboardMixin } from '@vaadin/a11y-base/src/keyboard-mixin.js';
13
15
  import { DelegateStateMixin } from '@vaadin/component-base/src/delegate-state-mixin.js';
14
- import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
15
16
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
16
- import { KeyboardMixin } from '@vaadin/component-base/src/keyboard-mixin.js';
17
17
  import { MediaQueryController } from '@vaadin/component-base/src/media-query-controller.js';
18
18
  import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
19
19
  import { processTemplates } from '@vaadin/component-base/src/templates.js';
20
20
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
21
21
  import { generateUniqueId } from '@vaadin/component-base/src/unique-id-utils.js';
22
22
  import { FieldMixin } from '@vaadin/field-base/src/field-mixin.js';
23
+ import { LabelController } from '@vaadin/field-base/src/label-controller.js';
23
24
  import { fieldShared } from '@vaadin/field-base/src/styles/field-shared-styles.js';
24
25
  import { inputFieldContainer } from '@vaadin/field-base/src/styles/input-field-container-styles.js';
26
+ import { screenReaderOnly } from '@vaadin/field-base/src/styles/sr-only-styles.js';
25
27
  import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
26
28
  import { ButtonController } from './button-controller.js';
27
29
 
28
- registerStyles('vaadin-select', [fieldShared, inputFieldContainer], { moduleId: 'vaadin-select-styles' });
30
+ registerStyles('vaadin-select', [fieldShared, inputFieldContainer, screenReaderOnly], {
31
+ moduleId: 'vaadin-select-styles',
32
+ });
29
33
 
30
34
  /**
31
35
  * `<vaadin-select>` is a Web Component for selecting values from a list of items.
@@ -193,6 +197,9 @@ class Select extends OverlayClassMixin(
193
197
  ></vaadin-select-overlay>
194
198
 
195
199
  <slot name="tooltip"></slot>
200
+ <div class="sr-only">
201
+ <slot name="sr-label"></slot>
202
+ </div>
196
203
  `;
197
204
  }
198
205
 
@@ -326,6 +333,8 @@ class Select extends OverlayClassMixin(
326
333
  super();
327
334
 
328
335
  this._itemId = `value-${this.localName}-${generateUniqueId()}`;
336
+ this._srLabelController = new LabelController(this);
337
+ this._srLabelController.slotName = 'sr-label';
329
338
  }
330
339
 
331
340
  /** @protected */
@@ -345,7 +354,7 @@ class Select extends OverlayClassMixin(
345
354
 
346
355
  this._valueButtonController = new ButtonController(this);
347
356
  this.addController(this._valueButtonController);
348
-
357
+ this.addController(this._srLabelController);
349
358
  this.addController(
350
359
  new MediaQueryController(this._phoneMediaQuery, (matches) => {
351
360
  this._phone = matches;
@@ -627,6 +636,44 @@ class Select extends OverlayClassMixin(
627
636
  itemElement.setAttribute('id', this._itemId);
628
637
  }
629
638
 
639
+ /**
640
+ * @param {string} accessibleName
641
+ * @protected
642
+ */
643
+ _accessibleNameChanged(accessibleName) {
644
+ this._srLabelController.setLabel(accessibleName);
645
+ this._setCustomAriaLabelledBy(accessibleName ? this._srLabelController.defaultId : null);
646
+ }
647
+
648
+ /**
649
+ * @param {string} accessibleNameRef
650
+ * @protected
651
+ */
652
+ _accessibleNameRefChanged(accessibleNameRef) {
653
+ this._setCustomAriaLabelledBy(accessibleNameRef);
654
+ }
655
+
656
+ /**
657
+ * @param {string} ariaLabelledby
658
+ * @private
659
+ */
660
+ _setCustomAriaLabelledBy(ariaLabelledby) {
661
+ const labelId = this._getLabelIdWithItemId(ariaLabelledby);
662
+ this._fieldAriaController.setLabelId(labelId, true);
663
+ }
664
+
665
+ /**
666
+ * @param {string | null} labelId
667
+ * @returns string | null
668
+ * @private
669
+ */
670
+ _getLabelIdWithItemId(labelId) {
671
+ const selected = this._items ? this._items[this._menuElement.selected] : false;
672
+ const itemId = selected || this.placeholder ? this._itemId : '';
673
+
674
+ return labelId ? `${labelId} ${itemId}`.trim() : null;
675
+ }
676
+
630
677
  /** @private */
631
678
  __updateValueButton() {
632
679
  const valueButton = this.focusElement;
@@ -662,11 +709,11 @@ class Select extends OverlayClassMixin(
662
709
  }
663
710
  }
664
711
 
665
- // Add the item ID to aria-labelledby if there is a selected item or a placeholder text.
666
- if (selected || this.placeholder) {
667
- addValueToAttribute(valueButton, 'aria-labelledby', this._itemId);
668
- } else {
669
- removeValueFromAttribute(valueButton, 'aria-labelledby', this._itemId);
712
+ const labelledIdReferenceConfig = selected || this.placeholder ? { newId: this._itemId } : { oldId: this._itemId };
713
+
714
+ setAriaIDReference(valueButton, 'aria-labelledby', labelledIdReferenceConfig);
715
+ if (this.accessibleName || this.accessibleNameRef) {
716
+ this._setCustomAriaLabelledBy(this.accessibleNameRef || this._srLabelController.defaultId);
670
717
  }
671
718
  }
672
719
 
package/web-types.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/select",
4
- "version": "24.0.5",
4
+ "version": "24.1.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "elements": [
9
9
  {
10
10
  "name": "vaadin-select",
11
- "description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-----------------------------|-----------\n`opened` | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
11
+ "description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-----------------------------|-----------\n`opened` | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
12
12
  "attributes": [
13
13
  {
14
14
  "name": "label",
@@ -65,6 +65,28 @@
65
65
  ]
66
66
  }
67
67
  },
68
+ {
69
+ "name": "accessible-name",
70
+ "description": "String used to label the component to screen reader users.",
71
+ "value": {
72
+ "type": [
73
+ "string",
74
+ "null",
75
+ "undefined"
76
+ ]
77
+ }
78
+ },
79
+ {
80
+ "name": "accessible-name-ref",
81
+ "description": "Id of the element used as label of the component to screen reader users.",
82
+ "value": {
83
+ "type": [
84
+ "string",
85
+ "null",
86
+ "undefined"
87
+ ]
88
+ }
89
+ },
68
90
  {
69
91
  "name": "disabled",
70
92
  "description": "If true, the user cannot interact with this element.",
@@ -216,6 +238,28 @@
216
238
  ]
217
239
  }
218
240
  },
241
+ {
242
+ "name": "accessibleName",
243
+ "description": "String used to label the component to screen reader users.",
244
+ "value": {
245
+ "type": [
246
+ "string",
247
+ "null",
248
+ "undefined"
249
+ ]
250
+ }
251
+ },
252
+ {
253
+ "name": "accessibleNameRef",
254
+ "description": "Id of the element used as label of the component to screen reader users.",
255
+ "value": {
256
+ "type": [
257
+ "string",
258
+ "null",
259
+ "undefined"
260
+ ]
261
+ }
262
+ },
219
263
  {
220
264
  "name": "disabled",
221
265
  "description": "If true, the user cannot interact with this element.",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/select",
4
- "version": "24.0.5",
4
+ "version": "24.1.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -16,7 +16,7 @@
16
16
  "elements": [
17
17
  {
18
18
  "name": "vaadin-select",
19
- "description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-----------------------------|-----------\n`opened` | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.0.5/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
19
+ "description": "`<vaadin-select>` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n<vaadin-select id=\"select\"></vaadin-select>\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n { label: 'Most recent first', value: 'recent' },\n { component: 'hr' },\n { label: 'Rating: low to high', value: 'rating-asc' },\n { label: 'Rating: high to low', value: 'rating-desc' },\n { component: 'hr' },\n { label: 'Price: low to high', value: 'price-asc', disabled: true },\n { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n const listBox = document.createElement('vaadin-list-box');\n // append 3 <vaadin-item> elements\n ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n const item = document.createElement('vaadin-item');\n item.textContent = name;\n item.setAttribute('label', name)\n listBox.appendChild(item);\n });\n\n // update the content\n root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Target element | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width` | Default width of the field | :host | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n\n`<vaadin-select>` provides mostly the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `<vaadin-text-field>` parts, the following parts are available for theming:\n\nPart name | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `<vaadin-text-field>` state attributes, the following state attributes are available for theming:\n\nAttribute | Description | Part name\n----------|-----------------------------|-----------\n`opened` | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to `<vaadin-text-field>`:\n- the `clear-button` shadow DOM part does not exist in `<vaadin-select>`.\n- the `input-prevented` state attribute is not supported by `<vaadin-select>`.\n\n### Internal components\n\nIn addition to `<vaadin-select>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-select-overlay>` - has the same API as [`<vaadin-overlay>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-overlay).\n- `<vaadin-select-value-button>` - has the same API as [`<vaadin-button>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-button).\n- [`<vaadin-input-container>`](https://cdn.vaadin.com/vaadin-web-components/24.1.0-alpha10/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `<vaadin-select>` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
20
20
  "extension": true,
21
21
  "attributes": [
22
22
  {
@@ -82,6 +82,20 @@
82
82
  "kind": "expression"
83
83
  }
84
84
  },
85
+ {
86
+ "name": ".accessibleName",
87
+ "description": "String used to label the component to screen reader users.",
88
+ "value": {
89
+ "kind": "expression"
90
+ }
91
+ },
92
+ {
93
+ "name": ".accessibleNameRef",
94
+ "description": "Id of the element used as label of the component to screen reader users.",
95
+ "value": {
96
+ "kind": "expression"
97
+ }
98
+ },
85
99
  {
86
100
  "name": ".overlayClass",
87
101
  "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",