@vaadin/a11y-base 24.1.0-alpha8 → 24.1.0-beta1
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/a11y-base",
|
|
3
|
-
"version": "24.1.0-
|
|
3
|
+
"version": "24.1.0-beta1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
34
34
|
"@polymer/polymer": "^3.0.0",
|
|
35
|
-
"@vaadin/component-base": "24.1.0-
|
|
35
|
+
"@vaadin/component-base": "24.1.0-beta1",
|
|
36
36
|
"lit": "^2.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@vaadin/testing-helpers": "^0.4.0",
|
|
41
41
|
"sinon": "^13.0.2"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "f0ddb6576073a6af05ab29867bc5ec82e334f9d7"
|
|
44
44
|
}
|
package/src/aria-id-reference.js
CHANGED
|
@@ -114,8 +114,8 @@ export function setAriaIDReference(target, attr, config = { newId: null, oldId:
|
|
|
114
114
|
if (!fromUser && !!storedValues) {
|
|
115
115
|
// If there's any stored values, it means the attribute is being handled by the user
|
|
116
116
|
// Replace the "oldId" with "newId" on the stored values set and leave
|
|
117
|
-
storedValues.delete(oldId);
|
|
118
|
-
storedValues.add(newId);
|
|
117
|
+
oldId && storedValues.delete(oldId);
|
|
118
|
+
newId && storedValues.add(newId);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
|
|
@@ -19,16 +19,6 @@ export class FieldAriaController {
|
|
|
19
19
|
this.__required = false;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* `true` if the target element is the host component itself, `false` otherwise.
|
|
24
|
-
*
|
|
25
|
-
* @return {boolean}
|
|
26
|
-
* @private
|
|
27
|
-
*/
|
|
28
|
-
get __isGroupField() {
|
|
29
|
-
return this.__target === this.host;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
22
|
/**
|
|
33
23
|
* Sets a target element to which ARIA attributes are added.
|
|
34
24
|
*
|
|
@@ -37,7 +27,11 @@ export class FieldAriaController {
|
|
|
37
27
|
setTarget(target) {
|
|
38
28
|
this.__target = target;
|
|
39
29
|
this.__setAriaRequiredAttribute(this.__required);
|
|
40
|
-
|
|
30
|
+
// We need to make sure that value in __labelId is stored
|
|
31
|
+
this.__setLabelIdToAriaAttribute(this.__labelId, this.__labelId);
|
|
32
|
+
if (this.__labelIdFromUser != null) {
|
|
33
|
+
this.__setLabelIdToAriaAttribute(this.__labelIdFromUser, this.__labelIdFromUser, true);
|
|
34
|
+
}
|
|
41
35
|
this.__setErrorIdToAriaAttribute(this.__errorId);
|
|
42
36
|
this.__setHelperIdToAriaAttribute(this.__helperId);
|
|
43
37
|
this.setAriaLabel(this.__label);
|
|
@@ -146,10 +140,7 @@ export class FieldAriaController {
|
|
|
146
140
|
* @private
|
|
147
141
|
*/
|
|
148
142
|
__setErrorIdToAriaAttribute(errorId, oldErrorId) {
|
|
149
|
-
|
|
150
|
-
// that should guarantee that it's announced when the group is entered.
|
|
151
|
-
const ariaAttribute = this.__isGroupField ? 'aria-labelledby' : 'aria-describedby';
|
|
152
|
-
setAriaIDReference(this.__target, ariaAttribute, { newId: errorId, oldId: oldErrorId, fromUser: false });
|
|
143
|
+
setAriaIDReference(this.__target, 'aria-describedby', { newId: errorId, oldId: oldErrorId, fromUser: false });
|
|
153
144
|
}
|
|
154
145
|
|
|
155
146
|
/**
|
|
@@ -158,10 +149,7 @@ export class FieldAriaController {
|
|
|
158
149
|
* @private
|
|
159
150
|
*/
|
|
160
151
|
__setHelperIdToAriaAttribute(helperId, oldHelperId) {
|
|
161
|
-
|
|
162
|
-
// that should guarantee that it's announced when the group is entered.
|
|
163
|
-
const ariaAttribute = this.__isGroupField ? 'aria-labelledby' : 'aria-describedby';
|
|
164
|
-
setAriaIDReference(this.__target, ariaAttribute, { newId: helperId, oldId: oldHelperId, fromUser: false });
|
|
152
|
+
setAriaIDReference(this.__target, 'aria-describedby', { newId: helperId, oldId: oldHelperId, fromUser: false });
|
|
165
153
|
}
|
|
166
154
|
|
|
167
155
|
/**
|
package/src/focus-utils.js
CHANGED
|
@@ -148,7 +148,9 @@ export function isElementHidden(element) {
|
|
|
148
148
|
// `offsetParent` is `null` when the element itself
|
|
149
149
|
// or one of its ancestors is hidden with `display: none`.
|
|
150
150
|
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
|
|
151
|
-
|
|
151
|
+
// However `offsetParent` is also null when the element is using fixed
|
|
152
|
+
// positioning, so additionally check if the element takes up layout space.
|
|
153
|
+
if (element.offsetParent === null && element.clientWidth === 0 && element.clientHeight === 0) {
|
|
152
154
|
return true;
|
|
153
155
|
}
|
|
154
156
|
|