@qualweb/util 0.7.1 → 0.7.3
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getLinkContext.d.ts","sourceRoot":"","sources":["../../src/accessibilityUtils/getLinkContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"getLinkContext.d.ts","sourceRoot":"","sources":["../../src/accessibilityUtils/getLinkContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAQrD,iBAAS,cAAc,CAAC,OAAO,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,CAAC,CAWzD;AA2BD,eAAe,cAAc,CAAC"}
|
|
@@ -8,18 +8,7 @@ function getLinkContext(element) {
|
|
|
8
8
|
if (ariaDescribedByATT)
|
|
9
9
|
ariaDescribedBy = ariaDescribedByATT.split(' ');
|
|
10
10
|
if (parent) {
|
|
11
|
-
|
|
12
|
-
const inAT = window.AccessibilityUtils.isElementInAT(parent);
|
|
13
|
-
const tagName = parent.getElementTagName();
|
|
14
|
-
const id = parent.getElementAttribute('id');
|
|
15
|
-
if (inAT &&
|
|
16
|
-
(tagName === 'p' ||
|
|
17
|
-
role === 'cell' ||
|
|
18
|
-
role === 'gridcell' ||
|
|
19
|
-
role === 'listitem' ||
|
|
20
|
-
(id && ariaDescribedBy.includes(id)))) {
|
|
21
|
-
context.push(parent.getElementSelector());
|
|
22
|
-
}
|
|
11
|
+
addContext(parent, ariaDescribedBy, context);
|
|
23
12
|
getLinkContextAux(parent, ariaDescribedBy, context);
|
|
24
13
|
}
|
|
25
14
|
return context;
|
|
@@ -27,19 +16,23 @@ function getLinkContext(element) {
|
|
|
27
16
|
function getLinkContextAux(element, ariaDescribedBy, context) {
|
|
28
17
|
const parent = element.getElementParent();
|
|
29
18
|
if (parent) {
|
|
30
|
-
|
|
31
|
-
const inAT = window.AccessibilityUtils.isElementInAT(parent);
|
|
32
|
-
const tagName = parent.getElementTagName();
|
|
33
|
-
const id = parent.getElementAttribute('id');
|
|
34
|
-
if (inAT &&
|
|
35
|
-
(tagName === 'p' ||
|
|
36
|
-
role === 'cell' ||
|
|
37
|
-
role === 'gridcell' ||
|
|
38
|
-
role === 'listitem' ||
|
|
39
|
-
(id && ariaDescribedBy.includes(id)))) {
|
|
40
|
-
context.push(parent.getElementSelector());
|
|
41
|
-
}
|
|
19
|
+
addContext(parent, ariaDescribedBy, context);
|
|
42
20
|
getLinkContextAux(parent, ariaDescribedBy, context);
|
|
43
21
|
}
|
|
44
22
|
}
|
|
23
|
+
function addContext(parent, ariaDescribedBy, context) {
|
|
24
|
+
var _a;
|
|
25
|
+
const role = window.AccessibilityUtils.getElementRole(parent);
|
|
26
|
+
const inAT = window.AccessibilityUtils.isElementInAT(parent);
|
|
27
|
+
const tagName = parent.getElementTagName();
|
|
28
|
+
const id = parent.getElementAttribute('id');
|
|
29
|
+
if (inAT &&
|
|
30
|
+
(tagName === 'p' ||
|
|
31
|
+
role === 'cell' ||
|
|
32
|
+
role === 'gridcell' ||
|
|
33
|
+
role === 'listitem' ||
|
|
34
|
+
(id && ariaDescribedBy.includes(id)))) {
|
|
35
|
+
context.push(((_a = parent.getElementText()) !== null && _a !== void 0 ? _a : '').replace(/\s+/g, ' ').trim());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
45
38
|
exports.default = getLinkContext;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qualweb/util",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Utilities module for qualweb",
|
|
5
5
|
"main": "dist/__webpack/util.bundle.js",
|
|
6
6
|
"files": [
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"require": "./dist/__webpack/util.bundle.js",
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/__webpack/util.bundle.js"
|
|
13
14
|
},
|
|
14
15
|
"./applicability": {
|
|
15
16
|
"require": "./dist/applicability/applicability.js",
|