@trackunit/react-core-contexts-test 1.11.9-alpha-e76d0654d61.0 → 1.11.9
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/index.cjs2.js +272 -172
- package/index.esm.js +1 -1
- package/index.esm2.js +264 -160
- package/package.json +5 -5
package/index.cjs2.js
CHANGED
|
@@ -17,10 +17,7 @@ var react = require('@apollo/client/react');
|
|
|
17
17
|
var reactRouter = require('@tanstack/react-router');
|
|
18
18
|
var graphql = require('graphql');
|
|
19
19
|
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _interopNamespace(e) {
|
|
23
|
-
if (e && e.__esModule) return e;
|
|
20
|
+
function _interopNamespaceDefault(e) {
|
|
24
21
|
var n = Object.create(null);
|
|
25
22
|
if (e) {
|
|
26
23
|
Object.keys(e).forEach(function (k) {
|
|
@@ -37,10 +34,9 @@ function _interopNamespace(e) {
|
|
|
37
34
|
return Object.freeze(n);
|
|
38
35
|
}
|
|
39
36
|
|
|
40
|
-
var React__namespace = /*#__PURE__*/
|
|
41
|
-
var DeprecatedReactTestUtils__namespace = /*#__PURE__*/
|
|
42
|
-
var
|
|
43
|
-
var ReactDOMClient__namespace = /*#__PURE__*/_interopNamespace(ReactDOMClient);
|
|
37
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
38
|
+
var DeprecatedReactTestUtils__namespace = /*#__PURE__*/_interopNamespaceDefault(DeprecatedReactTestUtils);
|
|
39
|
+
var ReactDOMClient__namespace = /*#__PURE__*/_interopNamespaceDefault(ReactDOMClient);
|
|
44
40
|
|
|
45
41
|
/**
|
|
46
42
|
* Do nothing
|
|
@@ -2578,20 +2574,27 @@ build.default = _default$2j;
|
|
|
2578
2574
|
* but without thisArg (too hard to type, no need to `this`)
|
|
2579
2575
|
*/
|
|
2580
2576
|
var toStr = Object.prototype.toString;
|
|
2577
|
+
|
|
2581
2578
|
function isCallable(fn) {
|
|
2582
2579
|
return typeof fn === "function" || toStr.call(fn) === "[object Function]";
|
|
2583
2580
|
}
|
|
2581
|
+
|
|
2584
2582
|
function toInteger(value) {
|
|
2585
2583
|
var number = Number(value);
|
|
2584
|
+
|
|
2586
2585
|
if (isNaN(number)) {
|
|
2587
2586
|
return 0;
|
|
2588
2587
|
}
|
|
2588
|
+
|
|
2589
2589
|
if (number === 0 || !isFinite(number)) {
|
|
2590
2590
|
return number;
|
|
2591
2591
|
}
|
|
2592
|
+
|
|
2592
2593
|
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
|
|
2593
2594
|
}
|
|
2595
|
+
|
|
2594
2596
|
var maxSafeInteger = Math.pow(2, 53) - 1;
|
|
2597
|
+
|
|
2595
2598
|
function toLength(value) {
|
|
2596
2599
|
var len = toInteger(value);
|
|
2597
2600
|
return Math.min(Math.max(len, 0), maxSafeInteger);
|
|
@@ -2601,6 +2604,7 @@ function toLength(value) {
|
|
|
2601
2604
|
* @param iterable An iterable object to convert to an array.
|
|
2602
2605
|
*/
|
|
2603
2606
|
|
|
2607
|
+
|
|
2604
2608
|
/**
|
|
2605
2609
|
* Creates an array from an iterable object.
|
|
2606
2610
|
* @param iterable An iterable object to convert to an array.
|
|
@@ -2610,64 +2614,70 @@ function toLength(value) {
|
|
|
2610
2614
|
function arrayFrom(arrayLike, mapFn) {
|
|
2611
2615
|
// 1. Let C be the this value.
|
|
2612
2616
|
// edit(@eps1lon): we're not calling it as Array.from
|
|
2613
|
-
var C = Array;
|
|
2617
|
+
var C = Array; // 2. Let items be ToObject(arrayLike).
|
|
2614
2618
|
|
|
2615
|
-
|
|
2616
|
-
var items = Object(arrayLike);
|
|
2619
|
+
var items = Object(arrayLike); // 3. ReturnIfAbrupt(items).
|
|
2617
2620
|
|
|
2618
|
-
// 3. ReturnIfAbrupt(items).
|
|
2619
2621
|
if (arrayLike == null) {
|
|
2620
2622
|
throw new TypeError("Array.from requires an array-like object - not null or undefined");
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
// 10. Let lenValue be Get(items, "length").
|
|
2623
|
+
} // 4. If mapfn is undefined, then let mapping be false.
|
|
2624
2624
|
// 11. Let len be ToLength(lenValue).
|
|
2625
|
-
var len = toLength(items.length);
|
|
2626
2625
|
|
|
2627
|
-
|
|
2626
|
+
|
|
2627
|
+
var len = toLength(items.length); // 13. If IsConstructor(C) is true, then
|
|
2628
2628
|
// 13. a. Let A be the result of calling the [[Construct]] internal method
|
|
2629
2629
|
// of C with an argument list containing the single item len.
|
|
2630
2630
|
// 14. a. Else, Let A be ArrayCreate(len).
|
|
2631
|
-
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
|
|
2632
2631
|
|
|
2633
|
-
// 16. Let k be 0.
|
|
2634
|
-
|
|
2635
|
-
// 17. Repeat, while k < len… (also steps a - h)
|
|
2632
|
+
var A = isCallable(C) ? Object(new C(len)) : new Array(len); // 16. Let k be 0.
|
|
2633
|
+
|
|
2634
|
+
var k = 0; // 17. Repeat, while k < len… (also steps a - h)
|
|
2635
|
+
|
|
2636
2636
|
var kValue;
|
|
2637
|
+
|
|
2637
2638
|
while (k < len) {
|
|
2638
2639
|
kValue = items[k];
|
|
2640
|
+
|
|
2639
2641
|
{
|
|
2640
2642
|
A[k] = kValue;
|
|
2641
2643
|
}
|
|
2644
|
+
|
|
2642
2645
|
k += 1;
|
|
2643
|
-
}
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
// 20. Return A.
|
|
2646
|
+
} // 18. Let putStatus be Put(A, "length", len, true).
|
|
2647
|
+
|
|
2648
|
+
|
|
2649
|
+
A.length = len; // 20. Return A.
|
|
2650
|
+
|
|
2647
2651
|
return A;
|
|
2648
2652
|
}
|
|
2649
2653
|
|
|
2650
|
-
function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); }
|
|
2651
2654
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2652
|
-
|
|
2655
|
+
|
|
2656
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2657
|
+
|
|
2653
2658
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
2654
|
-
|
|
2655
|
-
function
|
|
2656
|
-
|
|
2659
|
+
|
|
2660
|
+
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2661
|
+
|
|
2657
2662
|
// for environments without Set we fallback to arrays with unique members
|
|
2658
2663
|
var SetLike = /*#__PURE__*/function () {
|
|
2659
2664
|
function SetLike() {
|
|
2660
2665
|
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2666
|
+
|
|
2661
2667
|
_classCallCheck(this, SetLike);
|
|
2668
|
+
|
|
2662
2669
|
_defineProperty$2(this, "items", void 0);
|
|
2670
|
+
|
|
2663
2671
|
this.items = items;
|
|
2664
2672
|
}
|
|
2673
|
+
|
|
2665
2674
|
_createClass(SetLike, [{
|
|
2666
2675
|
key: "add",
|
|
2667
2676
|
value: function add(value) {
|
|
2668
2677
|
if (this.has(value) === false) {
|
|
2669
2678
|
this.items.push(value);
|
|
2670
2679
|
}
|
|
2680
|
+
|
|
2671
2681
|
return this;
|
|
2672
2682
|
}
|
|
2673
2683
|
}, {
|
|
@@ -2688,6 +2698,7 @@ var SetLike = /*#__PURE__*/function () {
|
|
|
2688
2698
|
key: "forEach",
|
|
2689
2699
|
value: function forEach(callbackfn) {
|
|
2690
2700
|
var _this = this;
|
|
2701
|
+
|
|
2691
2702
|
this.items.forEach(function (item) {
|
|
2692
2703
|
callbackfn(item, item, _this);
|
|
2693
2704
|
});
|
|
@@ -2703,8 +2714,10 @@ var SetLike = /*#__PURE__*/function () {
|
|
|
2703
2714
|
return this.items.length;
|
|
2704
2715
|
}
|
|
2705
2716
|
}]);
|
|
2717
|
+
|
|
2706
2718
|
return SetLike;
|
|
2707
2719
|
}();
|
|
2720
|
+
|
|
2708
2721
|
var SetLike$1 = typeof Set === "undefined" ? Set : SetLike;
|
|
2709
2722
|
|
|
2710
2723
|
// https://w3c.github.io/html-aria/#document-conformance-requirements-for-use-of-aria-attributes-in-html
|
|
@@ -2715,9 +2728,9 @@ var SetLike$1 = typeof Set === "undefined" ? Set : SetLike;
|
|
|
2715
2728
|
*/
|
|
2716
2729
|
function getLocalName(element) {
|
|
2717
2730
|
var _element$localName;
|
|
2731
|
+
|
|
2718
2732
|
return (// eslint-disable-next-line no-restricted-properties -- actual guard for environments without localName
|
|
2719
|
-
(_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName :
|
|
2720
|
-
// eslint-disable-next-line no-restricted-properties -- required for the fallback
|
|
2733
|
+
(_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName : // eslint-disable-next-line no-restricted-properties -- required for the fallback
|
|
2721
2734
|
element.tagName.toLowerCase()
|
|
2722
2735
|
);
|
|
2723
2736
|
}
|
|
@@ -2783,47 +2796,52 @@ var prohibitedAttributes = {
|
|
|
2783
2796
|
subscript: new Set(["aria-label", "aria-labelledby"]),
|
|
2784
2797
|
superscript: new Set(["aria-label", "aria-labelledby"])
|
|
2785
2798
|
};
|
|
2786
|
-
|
|
2787
2799
|
/**
|
|
2788
2800
|
*
|
|
2789
2801
|
* @param element
|
|
2790
2802
|
* @param role The role used for this element. This is specified to control whether you want to use the implicit or explicit role.
|
|
2791
2803
|
*/
|
|
2804
|
+
|
|
2792
2805
|
function hasGlobalAriaAttributes(element, role) {
|
|
2793
2806
|
// https://rawgit.com/w3c/aria/stable/#global_states
|
|
2794
2807
|
// commented attributes are deprecated
|
|
2795
|
-
return ["aria-atomic", "aria-busy", "aria-controls", "aria-current", "aria-describedby", "aria-details",
|
|
2796
|
-
// "
|
|
2797
|
-
"aria-
|
|
2798
|
-
// "
|
|
2799
|
-
"aria-flowto", "aria-grabbed",
|
|
2800
|
-
// "haspopup",
|
|
2801
|
-
"aria-hidden",
|
|
2802
|
-
// "invalid",
|
|
2808
|
+
return ["aria-atomic", "aria-busy", "aria-controls", "aria-current", "aria-describedby", "aria-details", // "disabled",
|
|
2809
|
+
"aria-dropeffect", // "errormessage",
|
|
2810
|
+
"aria-flowto", "aria-grabbed", // "haspopup",
|
|
2811
|
+
"aria-hidden", // "invalid",
|
|
2803
2812
|
"aria-keyshortcuts", "aria-label", "aria-labelledby", "aria-live", "aria-owns", "aria-relevant", "aria-roledescription"].some(function (attributeName) {
|
|
2804
2813
|
var _prohibitedAttributes;
|
|
2814
|
+
|
|
2805
2815
|
return element.hasAttribute(attributeName) && !((_prohibitedAttributes = prohibitedAttributes[role]) !== null && _prohibitedAttributes !== void 0 && _prohibitedAttributes.has(attributeName));
|
|
2806
2816
|
});
|
|
2807
2817
|
}
|
|
2818
|
+
|
|
2808
2819
|
function ignorePresentationalRole(element, implicitRole) {
|
|
2809
2820
|
// https://rawgit.com/w3c/aria/stable/#conflict_resolution_presentation_none
|
|
2810
2821
|
return hasGlobalAriaAttributes(element, implicitRole);
|
|
2811
2822
|
}
|
|
2823
|
+
|
|
2812
2824
|
function getRole(element) {
|
|
2813
2825
|
var explicitRole = getExplicitRole(element);
|
|
2826
|
+
|
|
2814
2827
|
if (explicitRole === null || explicitRole === "presentation") {
|
|
2815
2828
|
var implicitRole = getImplicitRole(element);
|
|
2829
|
+
|
|
2816
2830
|
if (explicitRole !== "presentation" || ignorePresentationalRole(element, implicitRole || "")) {
|
|
2817
2831
|
return implicitRole;
|
|
2818
2832
|
}
|
|
2819
2833
|
}
|
|
2834
|
+
|
|
2820
2835
|
return explicitRole;
|
|
2821
2836
|
}
|
|
2837
|
+
|
|
2822
2838
|
function getImplicitRole(element) {
|
|
2823
2839
|
var mappedByTag = localNameToRoleMappings[getLocalName(element)];
|
|
2840
|
+
|
|
2824
2841
|
if (mappedByTag !== undefined) {
|
|
2825
2842
|
return mappedByTag;
|
|
2826
2843
|
}
|
|
2844
|
+
|
|
2827
2845
|
switch (getLocalName(element)) {
|
|
2828
2846
|
case "a":
|
|
2829
2847
|
case "area":
|
|
@@ -2831,27 +2849,35 @@ function getImplicitRole(element) {
|
|
|
2831
2849
|
if (element.hasAttribute("href")) {
|
|
2832
2850
|
return "link";
|
|
2833
2851
|
}
|
|
2852
|
+
|
|
2834
2853
|
break;
|
|
2854
|
+
|
|
2835
2855
|
case "img":
|
|
2836
2856
|
if (element.getAttribute("alt") === "" && !ignorePresentationalRole(element, "img")) {
|
|
2837
2857
|
return "presentation";
|
|
2838
2858
|
}
|
|
2859
|
+
|
|
2839
2860
|
return "img";
|
|
2861
|
+
|
|
2840
2862
|
case "input":
|
|
2841
2863
|
{
|
|
2842
2864
|
var _ref = element,
|
|
2843
|
-
|
|
2865
|
+
type = _ref.type;
|
|
2866
|
+
|
|
2844
2867
|
switch (type) {
|
|
2845
2868
|
case "button":
|
|
2846
2869
|
case "image":
|
|
2847
2870
|
case "reset":
|
|
2848
2871
|
case "submit":
|
|
2849
2872
|
return "button";
|
|
2873
|
+
|
|
2850
2874
|
case "checkbox":
|
|
2851
2875
|
case "radio":
|
|
2852
2876
|
return type;
|
|
2877
|
+
|
|
2853
2878
|
case "range":
|
|
2854
2879
|
return "slider";
|
|
2880
|
+
|
|
2855
2881
|
case "email":
|
|
2856
2882
|
case "tel":
|
|
2857
2883
|
case "text":
|
|
@@ -2859,36 +2885,47 @@ function getImplicitRole(element) {
|
|
|
2859
2885
|
if (element.hasAttribute("list")) {
|
|
2860
2886
|
return "combobox";
|
|
2861
2887
|
}
|
|
2888
|
+
|
|
2862
2889
|
return "textbox";
|
|
2890
|
+
|
|
2863
2891
|
case "search":
|
|
2864
2892
|
if (element.hasAttribute("list")) {
|
|
2865
2893
|
return "combobox";
|
|
2866
2894
|
}
|
|
2895
|
+
|
|
2867
2896
|
return "searchbox";
|
|
2897
|
+
|
|
2868
2898
|
case "number":
|
|
2869
2899
|
return "spinbutton";
|
|
2900
|
+
|
|
2870
2901
|
default:
|
|
2871
2902
|
return null;
|
|
2872
2903
|
}
|
|
2873
2904
|
}
|
|
2905
|
+
|
|
2874
2906
|
case "select":
|
|
2875
2907
|
if (element.hasAttribute("multiple") || element.size > 1) {
|
|
2876
2908
|
return "listbox";
|
|
2877
2909
|
}
|
|
2910
|
+
|
|
2878
2911
|
return "combobox";
|
|
2879
2912
|
}
|
|
2913
|
+
|
|
2880
2914
|
return null;
|
|
2881
2915
|
}
|
|
2916
|
+
|
|
2882
2917
|
function getExplicitRole(element) {
|
|
2883
2918
|
var role = element.getAttribute("role");
|
|
2919
|
+
|
|
2884
2920
|
if (role !== null) {
|
|
2885
|
-
var explicitRole = role.trim().split(" ")[0];
|
|
2886
|
-
// String.prototype.split(sep, limit) will always return an array with at least one member
|
|
2921
|
+
var explicitRole = role.trim().split(" ")[0]; // String.prototype.split(sep, limit) will always return an array with at least one member
|
|
2887
2922
|
// as long as limit is either undefined or > 0
|
|
2923
|
+
|
|
2888
2924
|
if (explicitRole.length > 0) {
|
|
2889
2925
|
return explicitRole;
|
|
2890
2926
|
}
|
|
2891
2927
|
}
|
|
2928
|
+
|
|
2892
2929
|
return null;
|
|
2893
2930
|
}
|
|
2894
2931
|
|
|
@@ -2915,10 +2952,12 @@ function isHTMLTextAreaElement(node) {
|
|
|
2915
2952
|
}
|
|
2916
2953
|
function safeWindow(node) {
|
|
2917
2954
|
var _ref = node.ownerDocument === null ? node : node.ownerDocument,
|
|
2918
|
-
|
|
2955
|
+
defaultView = _ref.defaultView;
|
|
2956
|
+
|
|
2919
2957
|
if (defaultView === null) {
|
|
2920
2958
|
throw new TypeError("no window available");
|
|
2921
2959
|
}
|
|
2960
|
+
|
|
2922
2961
|
return defaultView;
|
|
2923
2962
|
}
|
|
2924
2963
|
function isHTMLFieldSetElement(node) {
|
|
@@ -2939,26 +2978,24 @@ function isSVGSVGElement(node) {
|
|
|
2939
2978
|
function isSVGTitleElement(node) {
|
|
2940
2979
|
return isSVGElement(node) && getLocalName(node) === "title";
|
|
2941
2980
|
}
|
|
2942
|
-
|
|
2943
2981
|
/**
|
|
2944
2982
|
*
|
|
2945
2983
|
* @param {Node} node -
|
|
2946
2984
|
* @param {string} attributeName -
|
|
2947
2985
|
* @returns {Element[]} -
|
|
2948
2986
|
*/
|
|
2987
|
+
|
|
2949
2988
|
function queryIdRefs(node, attributeName) {
|
|
2950
2989
|
if (isElement(node) && node.hasAttribute(attributeName)) {
|
|
2951
2990
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute check
|
|
2952
|
-
var ids = node.getAttribute(attributeName).split(" ");
|
|
2991
|
+
var ids = node.getAttribute(attributeName).split(" "); // Browsers that don't support shadow DOM won't have getRootNode
|
|
2953
2992
|
|
|
2954
|
-
// Browsers that don't support shadow DOM won't have getRootNode
|
|
2955
2993
|
var root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
|
|
2956
2994
|
return ids.map(function (id) {
|
|
2957
2995
|
return root.getElementById(id);
|
|
2958
2996
|
}).filter(function (element) {
|
|
2959
2997
|
return element !== null;
|
|
2960
|
-
}
|
|
2961
|
-
// TODO: why does this not narrow?
|
|
2998
|
+
} // TODO: why does this not narrow?
|
|
2962
2999
|
);
|
|
2963
3000
|
}
|
|
2964
3001
|
|
|
@@ -2968,13 +3005,13 @@ function hasAnyConcreteRoles(node, roles) {
|
|
|
2968
3005
|
if (isElement(node)) {
|
|
2969
3006
|
return roles.indexOf(getRole(node)) !== -1;
|
|
2970
3007
|
}
|
|
3008
|
+
|
|
2971
3009
|
return false;
|
|
2972
3010
|
}
|
|
2973
3011
|
|
|
2974
3012
|
/**
|
|
2975
3013
|
* implements https://w3c.github.io/accname/
|
|
2976
3014
|
*/
|
|
2977
|
-
|
|
2978
3015
|
/**
|
|
2979
3016
|
* A string of characters where all carriage returns, newlines, tabs, and form-feeds are replaced with a single space, and multiple spaces are reduced to a single space. The string contains only character data; it does not contain any markup.
|
|
2980
3017
|
*/
|
|
@@ -2987,48 +3024,56 @@ function hasAnyConcreteRoles(node, roles) {
|
|
|
2987
3024
|
function asFlatString(s) {
|
|
2988
3025
|
return s.trim().replace(/\s\s+/g, " ");
|
|
2989
3026
|
}
|
|
2990
|
-
|
|
2991
3027
|
/**
|
|
2992
3028
|
*
|
|
2993
3029
|
* @param node -
|
|
2994
3030
|
* @param options - These are not optional to prevent accidentally calling it without options in `computeAccessibleName`
|
|
2995
3031
|
* @returns {boolean} -
|
|
2996
3032
|
*/
|
|
3033
|
+
|
|
3034
|
+
|
|
2997
3035
|
function isHidden(node, getComputedStyleImplementation) {
|
|
2998
3036
|
if (!isElement(node)) {
|
|
2999
3037
|
return false;
|
|
3000
3038
|
}
|
|
3039
|
+
|
|
3001
3040
|
if (node.hasAttribute("hidden") || node.getAttribute("aria-hidden") === "true") {
|
|
3002
3041
|
return true;
|
|
3003
3042
|
}
|
|
3043
|
+
|
|
3004
3044
|
var style = getComputedStyleImplementation(node);
|
|
3005
3045
|
return style.getPropertyValue("display") === "none" || style.getPropertyValue("visibility") === "hidden";
|
|
3006
3046
|
}
|
|
3007
|
-
|
|
3008
3047
|
/**
|
|
3009
3048
|
* @param {Node} node -
|
|
3010
3049
|
* @returns {boolean} - As defined in step 2E of https://w3c.github.io/accname/#mapping_additional_nd_te
|
|
3011
3050
|
*/
|
|
3051
|
+
|
|
3052
|
+
|
|
3012
3053
|
function isControl(node) {
|
|
3013
3054
|
return hasAnyConcreteRoles(node, ["button", "combobox", "listbox", "textbox"]) || hasAbstractRole(node, "range");
|
|
3014
3055
|
}
|
|
3056
|
+
|
|
3015
3057
|
function hasAbstractRole(node, role) {
|
|
3016
3058
|
if (!isElement(node)) {
|
|
3017
3059
|
return false;
|
|
3018
3060
|
}
|
|
3061
|
+
|
|
3019
3062
|
switch (role) {
|
|
3020
3063
|
case "range":
|
|
3021
3064
|
return hasAnyConcreteRoles(node, ["meter", "progressbar", "scrollbar", "slider", "spinbutton"]);
|
|
3065
|
+
|
|
3022
3066
|
default:
|
|
3023
3067
|
throw new TypeError("No knowledge about abstract role '".concat(role, "'. This is likely a bug :("));
|
|
3024
3068
|
}
|
|
3025
3069
|
}
|
|
3026
|
-
|
|
3027
3070
|
/**
|
|
3028
3071
|
* element.querySelectorAll but also considers owned tree
|
|
3029
3072
|
* @param element
|
|
3030
3073
|
* @param selectors
|
|
3031
3074
|
*/
|
|
3075
|
+
|
|
3076
|
+
|
|
3032
3077
|
function querySelectorAllSubtree(element, selectors) {
|
|
3033
3078
|
var elements = arrayFrom(element.querySelectorAll(selectors));
|
|
3034
3079
|
queryIdRefs(element, "aria-owns").forEach(function (root) {
|
|
@@ -3037,17 +3082,19 @@ function querySelectorAllSubtree(element, selectors) {
|
|
|
3037
3082
|
});
|
|
3038
3083
|
return elements;
|
|
3039
3084
|
}
|
|
3085
|
+
|
|
3040
3086
|
function querySelectedOptions(listbox) {
|
|
3041
3087
|
if (isHTMLSelectElement(listbox)) {
|
|
3042
3088
|
// IE11 polyfill
|
|
3043
3089
|
return listbox.selectedOptions || querySelectorAllSubtree(listbox, "[selected]");
|
|
3044
3090
|
}
|
|
3091
|
+
|
|
3045
3092
|
return querySelectorAllSubtree(listbox, '[aria-selected="true"]');
|
|
3046
3093
|
}
|
|
3094
|
+
|
|
3047
3095
|
function isMarkedPresentational(node) {
|
|
3048
3096
|
return hasAnyConcreteRoles(node, ["none", "presentation"]);
|
|
3049
3097
|
}
|
|
3050
|
-
|
|
3051
3098
|
/**
|
|
3052
3099
|
* Elements specifically listed in html-aam
|
|
3053
3100
|
*
|
|
@@ -3058,63 +3105,75 @@ function isMarkedPresentational(node) {
|
|
|
3058
3105
|
*
|
|
3059
3106
|
* - https://w3c.github.io/html-aam/#table-element
|
|
3060
3107
|
*/
|
|
3108
|
+
|
|
3109
|
+
|
|
3061
3110
|
function isNativeHostLanguageTextAlternativeElement(node) {
|
|
3062
3111
|
return isHTMLTableCaptionElement(node);
|
|
3063
3112
|
}
|
|
3064
|
-
|
|
3065
3113
|
/**
|
|
3066
3114
|
* https://w3c.github.io/aria/#namefromcontent
|
|
3067
3115
|
*/
|
|
3116
|
+
|
|
3117
|
+
|
|
3068
3118
|
function allowsNameFromContent(node) {
|
|
3069
3119
|
return hasAnyConcreteRoles(node, ["button", "cell", "checkbox", "columnheader", "gridcell", "heading", "label", "legend", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "row", "rowheader", "switch", "tab", "tooltip", "treeitem"]);
|
|
3070
3120
|
}
|
|
3071
|
-
|
|
3072
3121
|
/**
|
|
3073
3122
|
* TODO https://github.com/eps1lon/dom-accessibility-api/issues/100
|
|
3074
3123
|
*/
|
|
3075
|
-
|
|
3076
|
-
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
function isDescendantOfNativeHostLanguageTextAlternativeElement( // eslint-disable-next-line @typescript-eslint/no-unused-vars -- not implemented yet
|
|
3077
3127
|
node) {
|
|
3078
3128
|
return false;
|
|
3079
3129
|
}
|
|
3130
|
+
|
|
3080
3131
|
function getValueOfTextbox(element) {
|
|
3081
3132
|
if (isHTMLInputElement(element) || isHTMLTextAreaElement(element)) {
|
|
3082
3133
|
return element.value;
|
|
3083
|
-
}
|
|
3084
|
-
|
|
3134
|
+
} // https://github.com/eps1lon/dom-accessibility-api/issues/4
|
|
3135
|
+
|
|
3136
|
+
|
|
3085
3137
|
return element.textContent || "";
|
|
3086
3138
|
}
|
|
3139
|
+
|
|
3087
3140
|
function getTextualContent(declaration) {
|
|
3088
3141
|
var content = declaration.getPropertyValue("content");
|
|
3142
|
+
|
|
3089
3143
|
if (/^["'].*["']$/.test(content)) {
|
|
3090
3144
|
return content.slice(1, -1);
|
|
3091
3145
|
}
|
|
3146
|
+
|
|
3092
3147
|
return "";
|
|
3093
3148
|
}
|
|
3094
|
-
|
|
3095
3149
|
/**
|
|
3096
3150
|
* https://html.spec.whatwg.org/multipage/forms.html#category-label
|
|
3097
3151
|
* TODO: form-associated custom elements
|
|
3098
3152
|
* @param element
|
|
3099
3153
|
*/
|
|
3154
|
+
|
|
3155
|
+
|
|
3100
3156
|
function isLabelableElement(element) {
|
|
3101
3157
|
var localName = getLocalName(element);
|
|
3102
3158
|
return localName === "button" || localName === "input" && element.getAttribute("type") !== "hidden" || localName === "meter" || localName === "output" || localName === "progress" || localName === "select" || localName === "textarea";
|
|
3103
3159
|
}
|
|
3104
|
-
|
|
3105
3160
|
/**
|
|
3106
3161
|
* > [...], then the first such descendant in tree order is the label element's labeled control.
|
|
3107
3162
|
* -- https://html.spec.whatwg.org/multipage/forms.html#labeled-control
|
|
3108
3163
|
* @param element
|
|
3109
3164
|
*/
|
|
3165
|
+
|
|
3166
|
+
|
|
3110
3167
|
function findLabelableElement(element) {
|
|
3111
3168
|
if (isLabelableElement(element)) {
|
|
3112
3169
|
return element;
|
|
3113
3170
|
}
|
|
3171
|
+
|
|
3114
3172
|
var labelableElement = null;
|
|
3115
3173
|
element.childNodes.forEach(function (childNode) {
|
|
3116
3174
|
if (labelableElement === null && isElement(childNode)) {
|
|
3117
3175
|
var descendantLabelableElement = findLabelableElement(childNode);
|
|
3176
|
+
|
|
3118
3177
|
if (descendantLabelableElement !== null) {
|
|
3119
3178
|
labelableElement = descendantLabelableElement;
|
|
3120
3179
|
}
|
|
@@ -3122,146 +3181,160 @@ function findLabelableElement(element) {
|
|
|
3122
3181
|
});
|
|
3123
3182
|
return labelableElement;
|
|
3124
3183
|
}
|
|
3125
|
-
|
|
3126
3184
|
/**
|
|
3127
3185
|
* Polyfill of HTMLLabelElement.control
|
|
3128
3186
|
* https://html.spec.whatwg.org/multipage/forms.html#labeled-control
|
|
3129
3187
|
* @param label
|
|
3130
3188
|
*/
|
|
3189
|
+
|
|
3190
|
+
|
|
3131
3191
|
function getControlOfLabel(label) {
|
|
3132
3192
|
if (label.control !== undefined) {
|
|
3133
3193
|
return label.control;
|
|
3134
3194
|
}
|
|
3195
|
+
|
|
3135
3196
|
var htmlFor = label.getAttribute("for");
|
|
3197
|
+
|
|
3136
3198
|
if (htmlFor !== null) {
|
|
3137
3199
|
return label.ownerDocument.getElementById(htmlFor);
|
|
3138
3200
|
}
|
|
3201
|
+
|
|
3139
3202
|
return findLabelableElement(label);
|
|
3140
3203
|
}
|
|
3141
|
-
|
|
3142
3204
|
/**
|
|
3143
3205
|
* Polyfill of HTMLInputElement.labels
|
|
3144
3206
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/labels
|
|
3145
3207
|
* @param element
|
|
3146
3208
|
*/
|
|
3209
|
+
|
|
3210
|
+
|
|
3147
3211
|
function getLabels$1(element) {
|
|
3148
3212
|
var labelsProperty = element.labels;
|
|
3213
|
+
|
|
3149
3214
|
if (labelsProperty === null) {
|
|
3150
3215
|
return labelsProperty;
|
|
3151
3216
|
}
|
|
3217
|
+
|
|
3152
3218
|
if (labelsProperty !== undefined) {
|
|
3153
3219
|
return arrayFrom(labelsProperty);
|
|
3154
|
-
}
|
|
3220
|
+
} // polyfill
|
|
3221
|
+
|
|
3155
3222
|
|
|
3156
|
-
// polyfill
|
|
3157
3223
|
if (!isLabelableElement(element)) {
|
|
3158
3224
|
return null;
|
|
3159
3225
|
}
|
|
3226
|
+
|
|
3160
3227
|
var document = element.ownerDocument;
|
|
3161
3228
|
return arrayFrom(document.querySelectorAll("label")).filter(function (label) {
|
|
3162
3229
|
return getControlOfLabel(label) === element;
|
|
3163
3230
|
});
|
|
3164
3231
|
}
|
|
3165
|
-
|
|
3166
3232
|
/**
|
|
3167
3233
|
* Gets the contents of a slot used for computing the accname
|
|
3168
3234
|
* @param slot
|
|
3169
3235
|
*/
|
|
3236
|
+
|
|
3237
|
+
|
|
3170
3238
|
function getSlotContents(slot) {
|
|
3171
3239
|
// Computing the accessible name for elements containing slots is not
|
|
3172
3240
|
// currently defined in the spec. This implementation reflects the
|
|
3173
3241
|
// behavior of NVDA 2020.2/Firefox 81 and iOS VoiceOver/Safari 13.6.
|
|
3174
3242
|
var assignedNodes = slot.assignedNodes();
|
|
3243
|
+
|
|
3175
3244
|
if (assignedNodes.length === 0) {
|
|
3176
3245
|
// if no nodes are assigned to the slot, it displays the default content
|
|
3177
3246
|
return arrayFrom(slot.childNodes);
|
|
3178
3247
|
}
|
|
3248
|
+
|
|
3179
3249
|
return assignedNodes;
|
|
3180
3250
|
}
|
|
3181
|
-
|
|
3182
3251
|
/**
|
|
3183
3252
|
* implements https://w3c.github.io/accname/#mapping_additional_nd_te
|
|
3184
3253
|
* @param root
|
|
3185
3254
|
* @param options
|
|
3186
3255
|
* @returns
|
|
3187
3256
|
*/
|
|
3257
|
+
|
|
3258
|
+
|
|
3188
3259
|
function computeTextAlternative(root) {
|
|
3189
3260
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3190
3261
|
var consultedNodes = new SetLike$1();
|
|
3191
3262
|
var window = safeWindow(root);
|
|
3192
3263
|
var _options$compute = options.compute,
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
// 2F.i
|
|
3264
|
+
compute = _options$compute === void 0 ? "name" : _options$compute,
|
|
3265
|
+
_options$computedStyl = options.computedStyleSupportsPseudoElements,
|
|
3266
|
+
computedStyleSupportsPseudoElements = _options$computedStyl === void 0 ? options.getComputedStyle !== undefined : _options$computedStyl,
|
|
3267
|
+
_options$getComputedS = options.getComputedStyle,
|
|
3268
|
+
getComputedStyle = _options$getComputedS === void 0 ? window.getComputedStyle.bind(window) : _options$getComputedS,
|
|
3269
|
+
_options$hidden = options.hidden,
|
|
3270
|
+
hidden = _options$hidden === void 0 ? false : _options$hidden; // 2F.i
|
|
3271
|
+
|
|
3202
3272
|
function computeMiscTextAlternative(node, context) {
|
|
3203
3273
|
var accumulatedText = "";
|
|
3274
|
+
|
|
3204
3275
|
if (isElement(node) && computedStyleSupportsPseudoElements) {
|
|
3205
3276
|
var pseudoBefore = getComputedStyle(node, "::before");
|
|
3206
3277
|
var beforeContent = getTextualContent(pseudoBefore);
|
|
3207
3278
|
accumulatedText = "".concat(beforeContent, " ").concat(accumulatedText);
|
|
3208
|
-
}
|
|
3209
|
-
|
|
3210
|
-
// FIXME: Including aria-owns is not defined in the spec
|
|
3279
|
+
} // FIXME: Including aria-owns is not defined in the spec
|
|
3211
3280
|
// But it is required in the web-platform-test
|
|
3281
|
+
|
|
3282
|
+
|
|
3212
3283
|
var childNodes = isHTMLSlotElement(node) ? getSlotContents(node) : arrayFrom(node.childNodes).concat(queryIdRefs(node, "aria-owns"));
|
|
3213
3284
|
childNodes.forEach(function (child) {
|
|
3214
3285
|
var result = computeTextAlternative(child, {
|
|
3215
3286
|
isEmbeddedInLabel: context.isEmbeddedInLabel,
|
|
3216
3287
|
isReferenced: false,
|
|
3217
3288
|
recursion: true
|
|
3218
|
-
});
|
|
3219
|
-
// TODO: Unclear why display affects delimiter
|
|
3289
|
+
}); // TODO: Unclear why display affects delimiter
|
|
3220
3290
|
// see https://github.com/w3c/accname/issues/3
|
|
3291
|
+
|
|
3221
3292
|
var display = isElement(child) ? getComputedStyle(child).getPropertyValue("display") : "inline";
|
|
3222
|
-
var separator = display !== "inline" ? " " : "";
|
|
3223
|
-
|
|
3293
|
+
var separator = display !== "inline" ? " " : ""; // trailing separator for wpt tests
|
|
3294
|
+
|
|
3224
3295
|
accumulatedText += "".concat(separator).concat(result).concat(separator);
|
|
3225
3296
|
});
|
|
3297
|
+
|
|
3226
3298
|
if (isElement(node) && computedStyleSupportsPseudoElements) {
|
|
3227
3299
|
var pseudoAfter = getComputedStyle(node, "::after");
|
|
3228
3300
|
var afterContent = getTextualContent(pseudoAfter);
|
|
3229
3301
|
accumulatedText = "".concat(accumulatedText, " ").concat(afterContent);
|
|
3230
3302
|
}
|
|
3303
|
+
|
|
3231
3304
|
return accumulatedText.trim();
|
|
3232
3305
|
}
|
|
3233
3306
|
|
|
3234
|
-
/**
|
|
3235
|
-
*
|
|
3236
|
-
* @param element
|
|
3237
|
-
* @param attributeName
|
|
3238
|
-
* @returns A string non-empty string or `null`
|
|
3239
|
-
*/
|
|
3240
|
-
function useAttribute(element, attributeName) {
|
|
3241
|
-
var attribute = element.getAttributeNode(attributeName);
|
|
3242
|
-
if (attribute !== null && !consultedNodes.has(attribute) && attribute.value.trim() !== "") {
|
|
3243
|
-
consultedNodes.add(attribute);
|
|
3244
|
-
return attribute.value;
|
|
3245
|
-
}
|
|
3246
|
-
return null;
|
|
3247
|
-
}
|
|
3248
|
-
function computeTooltipAttributeValue(node) {
|
|
3249
|
-
if (!isElement(node)) {
|
|
3250
|
-
return null;
|
|
3251
|
-
}
|
|
3252
|
-
return useAttribute(node, "title");
|
|
3253
|
-
}
|
|
3254
3307
|
function computeElementTextAlternative(node) {
|
|
3255
3308
|
if (!isElement(node)) {
|
|
3256
3309
|
return null;
|
|
3257
3310
|
}
|
|
3311
|
+
/**
|
|
3312
|
+
*
|
|
3313
|
+
* @param element
|
|
3314
|
+
* @param attributeName
|
|
3315
|
+
* @returns A string non-empty string or `null`
|
|
3316
|
+
*/
|
|
3317
|
+
|
|
3318
|
+
|
|
3319
|
+
function useAttribute(element, attributeName) {
|
|
3320
|
+
var attribute = element.getAttributeNode(attributeName);
|
|
3321
|
+
|
|
3322
|
+
if (attribute !== null && !consultedNodes.has(attribute) && attribute.value.trim() !== "") {
|
|
3323
|
+
consultedNodes.add(attribute);
|
|
3324
|
+
return attribute.value;
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
return null;
|
|
3328
|
+
} // https://w3c.github.io/html-aam/#fieldset-and-legend-elements
|
|
3329
|
+
|
|
3258
3330
|
|
|
3259
|
-
// https://w3c.github.io/html-aam/#fieldset-and-legend-elements
|
|
3260
3331
|
if (isHTMLFieldSetElement(node)) {
|
|
3261
3332
|
consultedNodes.add(node);
|
|
3262
3333
|
var children = arrayFrom(node.childNodes);
|
|
3334
|
+
|
|
3263
3335
|
for (var i = 0; i < children.length; i += 1) {
|
|
3264
3336
|
var child = children[i];
|
|
3337
|
+
|
|
3265
3338
|
if (isHTMLLegendElement(child)) {
|
|
3266
3339
|
return computeTextAlternative(child, {
|
|
3267
3340
|
isEmbeddedInLabel: false,
|
|
@@ -3273,9 +3346,12 @@ function computeTextAlternative(root) {
|
|
|
3273
3346
|
} else if (isHTMLTableElement(node)) {
|
|
3274
3347
|
// https://w3c.github.io/html-aam/#table-element
|
|
3275
3348
|
consultedNodes.add(node);
|
|
3349
|
+
|
|
3276
3350
|
var _children = arrayFrom(node.childNodes);
|
|
3351
|
+
|
|
3277
3352
|
for (var _i = 0; _i < _children.length; _i += 1) {
|
|
3278
3353
|
var _child = _children[_i];
|
|
3354
|
+
|
|
3279
3355
|
if (isHTMLTableCaptionElement(_child)) {
|
|
3280
3356
|
return computeTextAlternative(_child, {
|
|
3281
3357
|
isEmbeddedInLabel: false,
|
|
@@ -3287,44 +3363,55 @@ function computeTextAlternative(root) {
|
|
|
3287
3363
|
} else if (isSVGSVGElement(node)) {
|
|
3288
3364
|
// https://www.w3.org/TR/svg-aam-1.0/
|
|
3289
3365
|
consultedNodes.add(node);
|
|
3366
|
+
|
|
3290
3367
|
var _children2 = arrayFrom(node.childNodes);
|
|
3368
|
+
|
|
3291
3369
|
for (var _i2 = 0; _i2 < _children2.length; _i2 += 1) {
|
|
3292
3370
|
var _child2 = _children2[_i2];
|
|
3371
|
+
|
|
3293
3372
|
if (isSVGTitleElement(_child2)) {
|
|
3294
3373
|
return _child2.textContent;
|
|
3295
3374
|
}
|
|
3296
3375
|
}
|
|
3376
|
+
|
|
3297
3377
|
return null;
|
|
3298
3378
|
} else if (getLocalName(node) === "img" || getLocalName(node) === "area") {
|
|
3299
3379
|
// https://w3c.github.io/html-aam/#area-element
|
|
3300
3380
|
// https://w3c.github.io/html-aam/#img-element
|
|
3301
3381
|
var nameFromAlt = useAttribute(node, "alt");
|
|
3382
|
+
|
|
3302
3383
|
if (nameFromAlt !== null) {
|
|
3303
3384
|
return nameFromAlt;
|
|
3304
3385
|
}
|
|
3305
3386
|
} else if (isHTMLOptGroupElement(node)) {
|
|
3306
3387
|
var nameFromLabel = useAttribute(node, "label");
|
|
3388
|
+
|
|
3307
3389
|
if (nameFromLabel !== null) {
|
|
3308
3390
|
return nameFromLabel;
|
|
3309
3391
|
}
|
|
3310
3392
|
}
|
|
3393
|
+
|
|
3311
3394
|
if (isHTMLInputElement(node) && (node.type === "button" || node.type === "submit" || node.type === "reset")) {
|
|
3312
3395
|
// https://w3c.github.io/html-aam/#input-type-text-input-type-password-input-type-search-input-type-tel-input-type-email-input-type-url-and-textarea-element-accessible-description-computation
|
|
3313
3396
|
var nameFromValue = useAttribute(node, "value");
|
|
3397
|
+
|
|
3314
3398
|
if (nameFromValue !== null) {
|
|
3315
3399
|
return nameFromValue;
|
|
3316
|
-
}
|
|
3400
|
+
} // TODO: l10n
|
|
3401
|
+
|
|
3317
3402
|
|
|
3318
|
-
// TODO: l10n
|
|
3319
3403
|
if (node.type === "submit") {
|
|
3320
3404
|
return "Submit";
|
|
3321
|
-
}
|
|
3322
|
-
|
|
3405
|
+
} // TODO: l10n
|
|
3406
|
+
|
|
3407
|
+
|
|
3323
3408
|
if (node.type === "reset") {
|
|
3324
3409
|
return "Reset";
|
|
3325
3410
|
}
|
|
3326
3411
|
}
|
|
3412
|
+
|
|
3327
3413
|
var labels = getLabels$1(node);
|
|
3414
|
+
|
|
3328
3415
|
if (labels !== null && labels.length !== 0) {
|
|
3329
3416
|
consultedNodes.add(node);
|
|
3330
3417
|
return arrayFrom(labels).map(function (element) {
|
|
@@ -3336,102 +3423,112 @@ function computeTextAlternative(root) {
|
|
|
3336
3423
|
}).filter(function (label) {
|
|
3337
3424
|
return label.length > 0;
|
|
3338
3425
|
}).join(" ");
|
|
3339
|
-
}
|
|
3340
|
-
|
|
3341
|
-
// https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation
|
|
3426
|
+
} // https://w3c.github.io/html-aam/#input-type-image-accessible-name-computation
|
|
3342
3427
|
// TODO: wpt test consider label elements but html-aam does not mention them
|
|
3343
3428
|
// We follow existing implementations over spec
|
|
3429
|
+
|
|
3430
|
+
|
|
3344
3431
|
if (isHTMLInputElement(node) && node.type === "image") {
|
|
3345
3432
|
var _nameFromAlt = useAttribute(node, "alt");
|
|
3433
|
+
|
|
3346
3434
|
if (_nameFromAlt !== null) {
|
|
3347
3435
|
return _nameFromAlt;
|
|
3348
3436
|
}
|
|
3437
|
+
|
|
3349
3438
|
var nameFromTitle = useAttribute(node, "title");
|
|
3439
|
+
|
|
3350
3440
|
if (nameFromTitle !== null) {
|
|
3351
3441
|
return nameFromTitle;
|
|
3352
|
-
}
|
|
3442
|
+
} // TODO: l10n
|
|
3443
|
+
|
|
3353
3444
|
|
|
3354
|
-
// TODO: l10n
|
|
3355
3445
|
return "Submit Query";
|
|
3356
3446
|
}
|
|
3447
|
+
|
|
3357
3448
|
if (hasAnyConcreteRoles(node, ["button"])) {
|
|
3358
3449
|
// https://www.w3.org/TR/html-aam-1.0/#button-element
|
|
3359
3450
|
var nameFromSubTree = computeMiscTextAlternative(node, {
|
|
3360
3451
|
isEmbeddedInLabel: false});
|
|
3452
|
+
|
|
3361
3453
|
if (nameFromSubTree !== "") {
|
|
3362
3454
|
return nameFromSubTree;
|
|
3363
3455
|
}
|
|
3456
|
+
|
|
3457
|
+
return useAttribute(node, "title");
|
|
3364
3458
|
}
|
|
3365
|
-
|
|
3459
|
+
|
|
3460
|
+
return useAttribute(node, "title");
|
|
3366
3461
|
}
|
|
3462
|
+
|
|
3367
3463
|
function computeTextAlternative(current, context) {
|
|
3368
3464
|
if (consultedNodes.has(current)) {
|
|
3369
3465
|
return "";
|
|
3370
|
-
}
|
|
3466
|
+
} // 2A
|
|
3467
|
+
|
|
3371
3468
|
|
|
3372
|
-
// 2A
|
|
3373
3469
|
if (!hidden && isHidden(current, getComputedStyle) && !context.isReferenced) {
|
|
3374
3470
|
consultedNodes.add(current);
|
|
3375
3471
|
return "";
|
|
3376
|
-
}
|
|
3472
|
+
} // 2B
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
var labelElements = queryIdRefs(current, "aria-labelledby");
|
|
3377
3476
|
|
|
3378
|
-
// 2B
|
|
3379
|
-
var labelAttributeNode = isElement(current) ? current.getAttributeNode("aria-labelledby") : null;
|
|
3380
|
-
// TODO: Do we generally need to block query IdRefs of attributes we have already consulted?
|
|
3381
|
-
var labelElements = labelAttributeNode !== null && !consultedNodes.has(labelAttributeNode) ? queryIdRefs(current, "aria-labelledby") : [];
|
|
3382
3477
|
if (compute === "name" && !context.isReferenced && labelElements.length > 0) {
|
|
3383
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Can't be null here otherwise labelElements would be empty
|
|
3384
|
-
consultedNodes.add(labelAttributeNode);
|
|
3385
3478
|
return labelElements.map(function (element) {
|
|
3386
|
-
// TODO: Chrome will consider repeated values i.e. use a node multiple times while we'll bail out in computeTextAlternative.
|
|
3387
3479
|
return computeTextAlternative(element, {
|
|
3388
3480
|
isEmbeddedInLabel: context.isEmbeddedInLabel,
|
|
3389
3481
|
isReferenced: true,
|
|
3390
|
-
//
|
|
3482
|
+
// thais isn't recursion as specified, otherwise we would skip
|
|
3391
3483
|
// `aria-label` in
|
|
3392
3484
|
// <input id="myself" aria-label="foo" aria-labelledby="myself"
|
|
3393
3485
|
recursion: false
|
|
3394
3486
|
});
|
|
3395
3487
|
}).join(" ");
|
|
3396
|
-
}
|
|
3397
|
-
|
|
3398
|
-
// 2C
|
|
3488
|
+
} // 2C
|
|
3399
3489
|
// Changed from the spec in anticipation of https://github.com/w3c/accname/issues/64
|
|
3400
3490
|
// spec says we should only consider skipping if we have a non-empty label
|
|
3491
|
+
|
|
3492
|
+
|
|
3401
3493
|
var skipToStep2E = context.recursion && isControl(current) && compute === "name";
|
|
3494
|
+
|
|
3402
3495
|
if (!skipToStep2E) {
|
|
3403
3496
|
var ariaLabel = (isElement(current) && current.getAttribute("aria-label") || "").trim();
|
|
3497
|
+
|
|
3404
3498
|
if (ariaLabel !== "" && compute === "name") {
|
|
3405
3499
|
consultedNodes.add(current);
|
|
3406
3500
|
return ariaLabel;
|
|
3407
|
-
}
|
|
3501
|
+
} // 2D
|
|
3502
|
+
|
|
3408
3503
|
|
|
3409
|
-
// 2D
|
|
3410
3504
|
if (!isMarkedPresentational(current)) {
|
|
3411
3505
|
var elementTextAlternative = computeElementTextAlternative(current);
|
|
3506
|
+
|
|
3412
3507
|
if (elementTextAlternative !== null) {
|
|
3413
3508
|
consultedNodes.add(current);
|
|
3414
3509
|
return elementTextAlternative;
|
|
3415
3510
|
}
|
|
3416
3511
|
}
|
|
3417
|
-
}
|
|
3418
|
-
|
|
3419
|
-
// special casing, cheating to make tests pass
|
|
3512
|
+
} // special casing, cheating to make tests pass
|
|
3420
3513
|
// https://github.com/w3c/accname/issues/67
|
|
3514
|
+
|
|
3515
|
+
|
|
3421
3516
|
if (hasAnyConcreteRoles(current, ["menu"])) {
|
|
3422
3517
|
consultedNodes.add(current);
|
|
3423
3518
|
return "";
|
|
3424
|
-
}
|
|
3519
|
+
} // 2E
|
|
3520
|
+
|
|
3425
3521
|
|
|
3426
|
-
// 2E
|
|
3427
3522
|
if (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) {
|
|
3428
3523
|
if (hasAnyConcreteRoles(current, ["combobox", "listbox"])) {
|
|
3429
3524
|
consultedNodes.add(current);
|
|
3430
3525
|
var selectedOptions = querySelectedOptions(current);
|
|
3526
|
+
|
|
3431
3527
|
if (selectedOptions.length === 0) {
|
|
3432
3528
|
// defined per test `name_heading_combobox`
|
|
3433
3529
|
return isHTMLInputElement(current) ? current.value : "";
|
|
3434
3530
|
}
|
|
3531
|
+
|
|
3435
3532
|
return arrayFrom(selectedOptions).map(function (selectedOption) {
|
|
3436
3533
|
return computeTextAlternative(selectedOption, {
|
|
3437
3534
|
isEmbeddedInLabel: context.isEmbeddedInLabel,
|
|
@@ -3440,53 +3537,53 @@ function computeTextAlternative(root) {
|
|
|
3440
3537
|
});
|
|
3441
3538
|
}).join(" ");
|
|
3442
3539
|
}
|
|
3540
|
+
|
|
3443
3541
|
if (hasAbstractRole(current, "range")) {
|
|
3444
3542
|
consultedNodes.add(current);
|
|
3543
|
+
|
|
3445
3544
|
if (current.hasAttribute("aria-valuetext")) {
|
|
3446
3545
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard
|
|
3447
3546
|
return current.getAttribute("aria-valuetext");
|
|
3448
3547
|
}
|
|
3548
|
+
|
|
3449
3549
|
if (current.hasAttribute("aria-valuenow")) {
|
|
3450
3550
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- safe due to hasAttribute guard
|
|
3451
3551
|
return current.getAttribute("aria-valuenow");
|
|
3452
|
-
}
|
|
3453
|
-
|
|
3552
|
+
} // Otherwise, use the value as specified by a host language attribute.
|
|
3553
|
+
|
|
3554
|
+
|
|
3454
3555
|
return current.getAttribute("value") || "";
|
|
3455
3556
|
}
|
|
3557
|
+
|
|
3456
3558
|
if (hasAnyConcreteRoles(current, ["textbox"])) {
|
|
3457
3559
|
consultedNodes.add(current);
|
|
3458
3560
|
return getValueOfTextbox(current);
|
|
3459
3561
|
}
|
|
3460
|
-
}
|
|
3562
|
+
} // 2F: https://w3c.github.io/accname/#step2F
|
|
3563
|
+
|
|
3461
3564
|
|
|
3462
|
-
// 2F: https://w3c.github.io/accname/#step2F
|
|
3463
3565
|
if (allowsNameFromContent(current) || isElement(current) && context.isReferenced || isNativeHostLanguageTextAlternativeElement(current) || isDescendantOfNativeHostLanguageTextAlternativeElement()) {
|
|
3464
|
-
|
|
3566
|
+
consultedNodes.add(current);
|
|
3567
|
+
return computeMiscTextAlternative(current, {
|
|
3465
3568
|
isEmbeddedInLabel: context.isEmbeddedInLabel});
|
|
3466
|
-
if (accumulatedText2F !== "") {
|
|
3467
|
-
consultedNodes.add(current);
|
|
3468
|
-
return accumulatedText2F;
|
|
3469
|
-
}
|
|
3470
3569
|
}
|
|
3570
|
+
|
|
3471
3571
|
if (current.nodeType === current.TEXT_NODE) {
|
|
3472
3572
|
consultedNodes.add(current);
|
|
3473
3573
|
return current.textContent || "";
|
|
3474
3574
|
}
|
|
3575
|
+
|
|
3475
3576
|
if (context.recursion) {
|
|
3476
3577
|
consultedNodes.add(current);
|
|
3477
3578
|
return computeMiscTextAlternative(current, {
|
|
3478
3579
|
isEmbeddedInLabel: context.isEmbeddedInLabel});
|
|
3479
3580
|
}
|
|
3480
|
-
var tooltipAttributeValue = computeTooltipAttributeValue(current);
|
|
3481
|
-
if (tooltipAttributeValue !== null) {
|
|
3482
|
-
consultedNodes.add(current);
|
|
3483
|
-
return tooltipAttributeValue;
|
|
3484
|
-
}
|
|
3485
3581
|
|
|
3486
|
-
|
|
3582
|
+
|
|
3487
3583
|
consultedNodes.add(current);
|
|
3488
3584
|
return "";
|
|
3489
3585
|
}
|
|
3586
|
+
|
|
3490
3587
|
return asFlatString(computeTextAlternative(root, {
|
|
3491
3588
|
isEmbeddedInLabel: false,
|
|
3492
3589
|
// by spec computeAccessibleDescription starts with the referenced elements as roots
|
|
@@ -3495,56 +3592,59 @@ function computeTextAlternative(root) {
|
|
|
3495
3592
|
}));
|
|
3496
3593
|
}
|
|
3497
3594
|
|
|
3498
|
-
function _typeof$1(obj) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$1(obj); }
|
|
3499
3595
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3596
|
+
|
|
3500
3597
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), true).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
3501
|
-
function _defineProperty$1(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3502
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof$1(key) === "symbol" ? key : String(key); }
|
|
3503
|
-
function _toPrimitive(input, hint) { if (_typeof$1(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint); if (_typeof$1(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3504
3598
|
|
|
3599
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3505
3600
|
/**
|
|
3506
3601
|
* @param root
|
|
3507
3602
|
* @param options
|
|
3508
3603
|
* @returns
|
|
3509
3604
|
*/
|
|
3605
|
+
|
|
3510
3606
|
function computeAccessibleDescription(root) {
|
|
3511
3607
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3512
3608
|
var description = queryIdRefs(root, "aria-describedby").map(function (element) {
|
|
3513
3609
|
return computeTextAlternative(element, _objectSpread(_objectSpread({}, options), {}, {
|
|
3514
3610
|
compute: "description"
|
|
3515
3611
|
}));
|
|
3516
|
-
}).join(" ");
|
|
3517
|
-
|
|
3518
|
-
// TODO: Technically we need to make sure that node wasn't used for the accessible name
|
|
3612
|
+
}).join(" "); // TODO: Technically we need to make sure that node wasn't used for the accessible name
|
|
3519
3613
|
// This causes `description_1.0_combobox-focusable-manual` to fail
|
|
3520
3614
|
//
|
|
3521
3615
|
// https://www.w3.org/TR/html-aam-1.0/#accessible-name-and-description-computation
|
|
3522
3616
|
// says for so many elements to use the `title` that we assume all elements are considered
|
|
3617
|
+
|
|
3523
3618
|
if (description === "") {
|
|
3524
3619
|
var title = root.getAttribute("title");
|
|
3525
3620
|
description = title === null ? "" : title;
|
|
3526
3621
|
}
|
|
3622
|
+
|
|
3527
3623
|
return description;
|
|
3528
3624
|
}
|
|
3529
3625
|
|
|
3530
3626
|
/**
|
|
3531
3627
|
* https://w3c.github.io/aria/#namefromprohibited
|
|
3532
3628
|
*/
|
|
3629
|
+
|
|
3533
3630
|
function prohibitsNaming(node) {
|
|
3534
3631
|
return hasAnyConcreteRoles(node, ["caption", "code", "deletion", "emphasis", "generic", "insertion", "paragraph", "presentation", "strong", "subscript", "superscript"]);
|
|
3535
3632
|
}
|
|
3536
|
-
|
|
3537
3633
|
/**
|
|
3538
3634
|
* implements https://w3c.github.io/accname/#mapping_additional_nd_name
|
|
3539
3635
|
* @param root
|
|
3540
3636
|
* @param options
|
|
3541
3637
|
* @returns
|
|
3542
3638
|
*/
|
|
3639
|
+
|
|
3640
|
+
|
|
3543
3641
|
function computeAccessibleName(root) {
|
|
3544
3642
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3643
|
+
|
|
3545
3644
|
if (prohibitsNaming(root)) {
|
|
3546
3645
|
return "";
|
|
3547
3646
|
}
|
|
3647
|
+
|
|
3548
3648
|
return computeTextAlternative(root, options);
|
|
3549
3649
|
}
|
|
3550
3650
|
|
|
@@ -10217,14 +10317,14 @@ function createDOMElementFilter(filterNode) {
|
|
|
10217
10317
|
}
|
|
10218
10318
|
|
|
10219
10319
|
// We try to load node dependencies
|
|
10220
|
-
let
|
|
10320
|
+
let chalk = null;
|
|
10221
10321
|
let readFileSync = null;
|
|
10222
10322
|
let codeFrameColumns = null;
|
|
10223
10323
|
try {
|
|
10224
10324
|
const nodeRequire = module && module.require;
|
|
10225
10325
|
readFileSync = nodeRequire.call(module, 'fs').readFileSync;
|
|
10226
10326
|
codeFrameColumns = nodeRequire.call(module, '@babel/code-frame').codeFrameColumns;
|
|
10227
|
-
|
|
10327
|
+
chalk = nodeRequire.call(module, 'chalk');
|
|
10228
10328
|
} catch {
|
|
10229
10329
|
// We're in a browser environment
|
|
10230
10330
|
}
|
|
@@ -10251,7 +10351,7 @@ function getCodeFrame(frame) {
|
|
|
10251
10351
|
highlightCode: true,
|
|
10252
10352
|
linesBelow: 0
|
|
10253
10353
|
});
|
|
10254
|
-
return
|
|
10354
|
+
return chalk.dim(frameLocation) + "\n" + codeFrame + "\n";
|
|
10255
10355
|
}
|
|
10256
10356
|
function getUserCodeFrame() {
|
|
10257
10357
|
// If we couldn't load dependencies, we can't generate the user trace
|
|
@@ -10529,7 +10629,7 @@ function getLabels(container, element, _temp) {
|
|
|
10529
10629
|
|
|
10530
10630
|
function assertNotNullOrUndefined(matcher) {
|
|
10531
10631
|
if (matcher === null || matcher === undefined) {
|
|
10532
|
-
throw new Error(// eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- implicitly converting `T` to `string`
|
|
10632
|
+
throw new Error( // eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- implicitly converting `T` to `string`
|
|
10533
10633
|
"It looks like " + matcher + " was passed instead of a matcher. Did you do something like getByText(" + matcher + ")?");
|
|
10534
10634
|
}
|
|
10535
10635
|
}
|
|
@@ -11723,9 +11823,9 @@ const queryAllByRole = function (container, role, _temp) {
|
|
|
11723
11823
|
}
|
|
11724
11824
|
}
|
|
11725
11825
|
if (expanded !== undefined) {
|
|
11726
|
-
var _allRoles$
|
|
11826
|
+
var _allRoles$get10;
|
|
11727
11827
|
// guard against unknown roles
|
|
11728
|
-
if (((_allRoles$
|
|
11828
|
+
if (((_allRoles$get10 = roles_1.get(role)) == null ? void 0 : _allRoles$get10.props['aria-expanded']) === undefined) {
|
|
11729
11829
|
throw new Error("\"aria-expanded\" is not supported on role \"" + role + "\".");
|
|
11730
11830
|
}
|
|
11731
11831
|
}
|
|
@@ -13064,13 +13164,13 @@ function createConcurrentRoot(container, _ref) {
|
|
|
13064
13164
|
function createLegacyRoot(container) {
|
|
13065
13165
|
return {
|
|
13066
13166
|
hydrate(element) {
|
|
13067
|
-
|
|
13167
|
+
ReactDOM.hydrate(element, container);
|
|
13068
13168
|
},
|
|
13069
13169
|
render(element) {
|
|
13070
|
-
|
|
13170
|
+
ReactDOM.render(element, container);
|
|
13071
13171
|
},
|
|
13072
13172
|
unmount() {
|
|
13073
|
-
|
|
13173
|
+
ReactDOM.unmountComponentAtNode(container);
|
|
13074
13174
|
}
|
|
13075
13175
|
};
|
|
13076
13176
|
}
|
|
@@ -13146,7 +13246,7 @@ function render(ui, _temp) {
|
|
|
13146
13246
|
if (onUncaughtError !== undefined) {
|
|
13147
13247
|
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
|
|
13148
13248
|
}
|
|
13149
|
-
if (legacyRoot && typeof
|
|
13249
|
+
if (legacyRoot && typeof ReactDOM.render !== 'function') {
|
|
13150
13250
|
const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');
|
|
13151
13251
|
Error.captureStackTrace(error, render);
|
|
13152
13252
|
throw error;
|
|
@@ -13221,7 +13321,7 @@ function renderHook(renderCallback, options) {
|
|
|
13221
13321
|
initialProps,
|
|
13222
13322
|
...renderOptions
|
|
13223
13323
|
} = options;
|
|
13224
|
-
if (renderOptions.legacyRoot && typeof
|
|
13324
|
+
if (renderOptions.legacyRoot && typeof ReactDOM.render !== 'function') {
|
|
13225
13325
|
const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');
|
|
13226
13326
|
Error.captureStackTrace(error, renderHook);
|
|
13227
13327
|
throw error;
|
|
@@ -14272,7 +14372,7 @@ const useDebugger = (propsToWatch, id, dontLogReRender) => {
|
|
|
14272
14372
|
const Debugger = ({ id, logPropsChanges, stop, children, }) => {
|
|
14273
14373
|
const uniqueId = id ||
|
|
14274
14374
|
// @ts-ignore
|
|
14275
|
-
|
|
14375
|
+
React["__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED"]?.ReactCurrentOwner?.current?._debugOwner?.type?.name ||
|
|
14276
14376
|
new Error().stack?.split("\n")[2]?.trim() ||
|
|
14277
14377
|
"unknown-id";
|
|
14278
14378
|
useDebugger(logPropsChanges || {}, id);
|