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