@vaadin/field-base 24.1.0-alpha2 → 24.1.0-alpha4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/field-base",
3
- "version": "24.1.0-alpha2",
3
+ "version": "24.1.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,8 +32,8 @@
32
32
  "dependencies": {
33
33
  "@open-wc/dedupe-mixin": "^1.3.0",
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/a11y-base": "24.1.0-alpha2",
36
- "@vaadin/component-base": "24.1.0-alpha2",
35
+ "@vaadin/a11y-base": "24.1.0-alpha4",
36
+ "@vaadin/component-base": "24.1.0-alpha4",
37
37
  "lit": "^2.0.0"
38
38
  },
39
39
  "devDependencies": {
@@ -41,5 +41,5 @@
41
41
  "@vaadin/testing-helpers": "^0.4.0",
42
42
  "sinon": "^13.0.2"
43
43
  },
44
- "gitHead": "9e3ee2557109030f2aba59e17a84e4e121d699c0"
44
+ "gitHead": "4494259f3b7532acb604a3048d5b29a4e14b9ca5"
45
45
  }
@@ -39,6 +39,18 @@ export declare class FieldMixinClass {
39
39
  */
40
40
  errorMessage: string | null | undefined;
41
41
 
42
+ /**
43
+ * String used to label the component to screen reader users.
44
+ * @attr {string} accessible-name
45
+ */
46
+ accessibleName: string | null | undefined;
47
+
48
+ /**
49
+ * Id of the element used as label of the component to screen reader users.
50
+ * @attr {string} accessible-name-ref
51
+ */
52
+ accessibleNameRef: string | null | undefined;
53
+
42
54
  protected readonly _errorNode: HTMLElement;
43
55
 
44
56
  protected readonly _helperNode?: HTMLElement;
@@ -49,6 +49,24 @@ export const FieldMixin = (superclass) =>
49
49
  type: String,
50
50
  observer: '_helperTextChanged',
51
51
  },
52
+
53
+ /**
54
+ * String used to label the component to screen reader users.
55
+ * @attr {string} accessible-name
56
+ */
57
+ accessibleName: {
58
+ type: String,
59
+ observer: '_accessibleNameChanged',
60
+ },
61
+
62
+ /**
63
+ * Id of the element used as label of the component to screen reader users.
64
+ * @attr {string} accessible-name-ref
65
+ */
66
+ accessibleNameRef: {
67
+ type: String,
68
+ observer: '_accessibleNameRefChanged',
69
+ },
52
70
  };
53
71
  }
54
72
 
@@ -113,6 +131,16 @@ export const FieldMixin = (superclass) =>
113
131
  }
114
132
  }
115
133
 
134
+ /** @private */
135
+ _accessibleNameChanged(accessibleName) {
136
+ this._fieldAriaController.setAriaLabel(accessibleName);
137
+ }
138
+
139
+ /** @private */
140
+ _accessibleNameRefChanged(accessibleNameRef) {
141
+ this._fieldAriaController.setLabelId(accessibleNameRef, true);
142
+ }
143
+
116
144
  /** @private */
117
145
  __labelChanged(hasLabel, labelNode) {
118
146
  // Label ID should be only added when the label content is present.