aria-api 0.4.4 → 0.4.6
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/dist/aria.js +12 -3
- package/lib/attrs.js +1 -1
- package/lib/constants.js +3 -0
- package/lib/name.js +8 -2
- package/package.json +1 -1
package/dist/aria.js
CHANGED
|
@@ -163,7 +163,7 @@ var getAttribute = function(el, key) {
|
|
|
163
163
|
if (el.matches('noscript')) {
|
|
164
164
|
return true;
|
|
165
165
|
}
|
|
166
|
-
if (el.matches('details:not([open]) :not(summary)')) {
|
|
166
|
+
if (el.matches('details:not([open]) > :not(summary)')) {
|
|
167
167
|
return true;
|
|
168
168
|
}
|
|
169
169
|
var style = window.getComputedStyle(el);
|
|
@@ -528,6 +528,9 @@ exports.roles = {
|
|
|
528
528
|
'selected': 'false',
|
|
529
529
|
},
|
|
530
530
|
},
|
|
531
|
+
presentation: {
|
|
532
|
+
selectors: ['img[alt=""]'],
|
|
533
|
+
},
|
|
531
534
|
progressbar: {
|
|
532
535
|
selectors: ['progress'],
|
|
533
536
|
},
|
|
@@ -834,7 +837,7 @@ var allowNameFromContent = function(el) {
|
|
|
834
837
|
|
|
835
838
|
var isInLabelForOtherWidget = function(el) {
|
|
836
839
|
var label = el.parentElement.closest('label');
|
|
837
|
-
return label && (!el.
|
|
840
|
+
return label && (!el.labels || !Array.prototype.includes.call(el.labels, label));
|
|
838
841
|
};
|
|
839
842
|
|
|
840
843
|
var getName = function(el, recursive, visited, directReference) {
|
|
@@ -932,10 +935,16 @@ var getName = function(el, recursive, visited, directReference) {
|
|
|
932
935
|
|
|
933
936
|
// I
|
|
934
937
|
// FIXME: presentation not mentioned in the spec
|
|
935
|
-
if (!ret.trim() && !query.matches(el, 'presentation')) {
|
|
938
|
+
if (!ret.trim() && (directReference || !query.matches(el, 'presentation'))) {
|
|
936
939
|
ret = el.title || '';
|
|
937
940
|
}
|
|
938
941
|
|
|
942
|
+
// FIXME: not exactly sure about this, but it reduces the number of failing
|
|
943
|
+
// WPT tests. Whitespace is hard.
|
|
944
|
+
if (!ret.trim()) {
|
|
945
|
+
ret = ' ';
|
|
946
|
+
}
|
|
947
|
+
|
|
939
948
|
var before = getPseudoContent(el, ':before');
|
|
940
949
|
var after = getPseudoContent(el, ':after');
|
|
941
950
|
return before + ret + after;
|
package/lib/attrs.js
CHANGED
|
@@ -50,7 +50,7 @@ var getAttribute = function(el, key) {
|
|
|
50
50
|
if (el.matches('noscript')) {
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
|
-
if (el.matches('details:not([open]) :not(summary)')) {
|
|
53
|
+
if (el.matches('details:not([open]) > :not(summary)')) {
|
|
54
54
|
return true;
|
|
55
55
|
}
|
|
56
56
|
var style = window.getComputedStyle(el);
|
package/lib/constants.js
CHANGED
package/lib/name.js
CHANGED
|
@@ -51,7 +51,7 @@ var allowNameFromContent = function(el) {
|
|
|
51
51
|
|
|
52
52
|
var isInLabelForOtherWidget = function(el) {
|
|
53
53
|
var label = el.parentElement.closest('label');
|
|
54
|
-
return label && (!el.
|
|
54
|
+
return label && (!el.labels || !Array.prototype.includes.call(el.labels, label));
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
var getName = function(el, recursive, visited, directReference) {
|
|
@@ -149,10 +149,16 @@ var getName = function(el, recursive, visited, directReference) {
|
|
|
149
149
|
|
|
150
150
|
// I
|
|
151
151
|
// FIXME: presentation not mentioned in the spec
|
|
152
|
-
if (!ret.trim() && !query.matches(el, 'presentation')) {
|
|
152
|
+
if (!ret.trim() && (directReference || !query.matches(el, 'presentation'))) {
|
|
153
153
|
ret = el.title || '';
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
// FIXME: not exactly sure about this, but it reduces the number of failing
|
|
157
|
+
// WPT tests. Whitespace is hard.
|
|
158
|
+
if (!ret.trim()) {
|
|
159
|
+
ret = ' ';
|
|
160
|
+
}
|
|
161
|
+
|
|
156
162
|
var before = getPseudoContent(el, ':before');
|
|
157
163
|
var after = getPseudoContent(el, ':after');
|
|
158
164
|
return before + ret + after;
|