@instructure/ui-a11y-utils 10.16.1-snapshot-0 → 10.16.1-snapshot-1
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/CHANGELOG.md +1 -1
- package/es/__new-tests__/FocusRegionManager.test.js +148 -103
- package/es/__new-tests__/ScreenReaderFocusRegion.test.js +81 -55
- package/es/__new-tests__/hasVisibleChildren.test.js +7 -3
- package/es/__new-tests__/scopeTab.test.js +23 -14
- package/es/hasVisibleChildren.js +2 -2
- package/lib/__new-tests__/FocusRegionManager.test.js +155 -112
- package/lib/__new-tests__/ScreenReaderFocusRegion.test.js +108 -83
- package/lib/__new-tests__/hasVisibleChildren.test.js +7 -4
- package/lib/__new-tests__/scopeTab.test.js +35 -27
- package/lib/hasVisibleChildren.js +2 -3
- package/package.json +9 -9
- package/src/__new-tests__/FocusRegionManager.test.tsx +1 -2
- package/src/__new-tests__/ScreenReaderFocusRegion.test.tsx +0 -2
- package/src/__new-tests__/hasVisibleChildren.test.tsx +0 -1
- package/src/__new-tests__/scopeTab.test.tsx +0 -2
- package/src/hasVisibleChildren.ts +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/__new-tests__/ScreenReaderFocusRegion.test.d.ts.map +1 -1
- package/types/__new-tests__/hasVisibleChildren.test.d.ts.map +1 -1
- package/types/__new-tests__/scopeTab.test.d.ts.map +1 -1
- package/types/hasVisibleChildren.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [10.16.1-snapshot-
|
|
6
|
+
## [10.16.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-1) (2025-04-22)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-a11y-utils
|
|
9
9
|
|
|
@@ -22,69 +22,92 @@ var _div, _div2;
|
|
|
22
22
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
27
27
|
import '@testing-library/jest-dom';
|
|
28
28
|
import { FocusRegionManager } from '../FocusRegionManager';
|
|
29
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
29
30
|
describe('FocusRegionManager', () => {
|
|
30
31
|
beforeEach(async () => {
|
|
31
32
|
FocusRegionManager.clearEntries();
|
|
32
33
|
});
|
|
33
34
|
it('should focus the first tabbable element when focused', async () => {
|
|
34
|
-
render(_div || (_div =
|
|
35
|
+
render(_div || (_div = _jsxs("div", {
|
|
35
36
|
"data-test-parent": true,
|
|
36
37
|
role: "main",
|
|
37
38
|
"aria-label": "test app",
|
|
38
|
-
id: "test-parent3"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
39
|
+
id: "test-parent3",
|
|
40
|
+
children: [_jsx("div", {
|
|
41
|
+
"data-test-ignore": true,
|
|
42
|
+
role: "alert",
|
|
43
|
+
children: _jsx("span", {
|
|
44
|
+
children: "test alert"
|
|
45
|
+
})
|
|
46
|
+
}), _jsxs("div", {
|
|
47
|
+
"data-test-child": true,
|
|
48
|
+
children: [_jsx("div", {
|
|
49
|
+
"data-test-descendant": true
|
|
50
|
+
}), _jsx("div", {
|
|
51
|
+
"data-test-descendant": true,
|
|
52
|
+
children: _jsx("div", {
|
|
53
|
+
"data-test-descendant": true,
|
|
54
|
+
children: _jsx("button", {
|
|
55
|
+
"data-testid": "button",
|
|
56
|
+
children: "click me"
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})]
|
|
60
|
+
}), _jsxs("div", {
|
|
61
|
+
"data-test-parent": true,
|
|
62
|
+
"aria-hidden": "true",
|
|
63
|
+
id: "test-parent2",
|
|
64
|
+
children: [_jsx("div", {
|
|
65
|
+
"data-test-child": true
|
|
66
|
+
}), _jsxs("div", {
|
|
67
|
+
role: "dialog",
|
|
68
|
+
"aria-label": "some content",
|
|
69
|
+
"data-test-parent": true,
|
|
70
|
+
id: "test-parent1",
|
|
71
|
+
children: [_jsxs("div", {
|
|
72
|
+
"data-testid": "content",
|
|
73
|
+
children: [_jsx("div", {
|
|
74
|
+
children: "Hello world"
|
|
75
|
+
}), _jsx("button", {
|
|
76
|
+
"data-testid": "first-tabbable",
|
|
77
|
+
children: "click me"
|
|
78
|
+
}), _jsx("button", {
|
|
79
|
+
children: "or click me"
|
|
80
|
+
})]
|
|
81
|
+
}), _jsx("span", {
|
|
82
|
+
"data-test-child": true,
|
|
83
|
+
children: _jsxs("ul", {
|
|
84
|
+
"data-test-descendant": true,
|
|
85
|
+
children: [_jsx("li", {
|
|
86
|
+
"data-test-descendant": true,
|
|
87
|
+
children: "item 1"
|
|
88
|
+
}), _jsx("li", {
|
|
89
|
+
"data-test-descendant": true,
|
|
90
|
+
children: "item 2"
|
|
91
|
+
}), _jsx("li", {
|
|
92
|
+
"data-test-descendant": true,
|
|
93
|
+
children: "item 3"
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
96
|
+
})]
|
|
97
|
+
})]
|
|
98
|
+
}), _jsxs("div", {
|
|
99
|
+
"data-test-child": true,
|
|
100
|
+
"aria-hidden": "true",
|
|
101
|
+
children: [_jsx("div", {
|
|
102
|
+
"data-test-descendant": true
|
|
103
|
+
}), _jsx("div", {
|
|
104
|
+
"data-test-descendant": true
|
|
105
|
+
})]
|
|
106
|
+
}), _jsx("iframe", {
|
|
107
|
+
id: "frame",
|
|
108
|
+
title: "frame"
|
|
109
|
+
})]
|
|
110
|
+
})));
|
|
88
111
|
const button = screen.getByTestId('button');
|
|
89
112
|
const content = screen.getByTestId('content');
|
|
90
113
|
const firstTabbable = screen.getByTestId('first-tabbable');
|
|
@@ -96,60 +119,82 @@ describe('FocusRegionManager', () => {
|
|
|
96
119
|
});
|
|
97
120
|
});
|
|
98
121
|
it('should return focus when blurred', async () => {
|
|
99
|
-
render(_div2 || (_div2 =
|
|
122
|
+
render(_div2 || (_div2 = _jsxs("div", {
|
|
100
123
|
"data-test-parent": true,
|
|
101
124
|
role: "main",
|
|
102
125
|
"aria-label": "test app",
|
|
103
|
-
id: "test-parent3"
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
"
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
126
|
+
id: "test-parent3",
|
|
127
|
+
children: [_jsx("div", {
|
|
128
|
+
"data-test-ignore": true,
|
|
129
|
+
role: "alert",
|
|
130
|
+
children: _jsx("span", {
|
|
131
|
+
children: "test alert"
|
|
132
|
+
})
|
|
133
|
+
}), _jsxs("div", {
|
|
134
|
+
"data-test-child": true,
|
|
135
|
+
children: [_jsx("div", {
|
|
136
|
+
"data-test-descendant": true
|
|
137
|
+
}), _jsx("div", {
|
|
138
|
+
"data-test-descendant": true,
|
|
139
|
+
children: _jsx("div", {
|
|
140
|
+
"data-test-descendant": true,
|
|
141
|
+
children: _jsx("button", {
|
|
142
|
+
"data-testid": "button",
|
|
143
|
+
children: "click me"
|
|
144
|
+
})
|
|
145
|
+
})
|
|
146
|
+
})]
|
|
147
|
+
}), _jsxs("div", {
|
|
148
|
+
"data-test-parent": true,
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
id: "test-parent2",
|
|
151
|
+
children: [_jsx("div", {
|
|
152
|
+
"data-test-child": true
|
|
153
|
+
}), _jsxs("div", {
|
|
154
|
+
role: "dialog",
|
|
155
|
+
"aria-label": "some content",
|
|
156
|
+
"data-test-parent": true,
|
|
157
|
+
id: "test-parent1",
|
|
158
|
+
children: [_jsxs("div", {
|
|
159
|
+
"data-testid": "content",
|
|
160
|
+
children: [_jsx("div", {
|
|
161
|
+
children: "Hello world"
|
|
162
|
+
}), _jsx("button", {
|
|
163
|
+
"data-test-first-tabbable": true,
|
|
164
|
+
children: "click me"
|
|
165
|
+
}), _jsx("button", {
|
|
166
|
+
children: "or click me"
|
|
167
|
+
})]
|
|
168
|
+
}), _jsx("span", {
|
|
169
|
+
"data-test-child": true,
|
|
170
|
+
children: _jsxs("ul", {
|
|
171
|
+
"data-test-descendant": true,
|
|
172
|
+
children: [_jsx("li", {
|
|
173
|
+
"data-test-descendant": true,
|
|
174
|
+
children: "item 1"
|
|
175
|
+
}), _jsx("li", {
|
|
176
|
+
"data-test-descendant": true,
|
|
177
|
+
children: "item 2"
|
|
178
|
+
}), _jsx("li", {
|
|
179
|
+
"data-test-descendant": true,
|
|
180
|
+
children: "item 3"
|
|
181
|
+
})]
|
|
182
|
+
})
|
|
183
|
+
})]
|
|
184
|
+
})]
|
|
185
|
+
}), _jsxs("div", {
|
|
186
|
+
"data-test-child": true,
|
|
187
|
+
"aria-hidden": "true",
|
|
188
|
+
children: [_jsx("div", {
|
|
189
|
+
"data-test-descendant": true
|
|
190
|
+
}), _jsx("div", {
|
|
191
|
+
"data-test-descendant": true
|
|
192
|
+
})]
|
|
193
|
+
}), _jsx("iframe", {
|
|
194
|
+
id: "frame",
|
|
195
|
+
title: "frame"
|
|
196
|
+
})]
|
|
197
|
+
})));
|
|
153
198
|
const button = screen.getByTestId('button');
|
|
154
199
|
const content = screen.getByTestId('content');
|
|
155
200
|
button.focus();
|
|
@@ -23,58 +23,83 @@ var _div, _div2;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
28
27
|
import '@testing-library/jest-dom';
|
|
29
28
|
import { ScreenReaderFocusRegion } from '../ScreenReaderFocusRegion';
|
|
29
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
30
30
|
describe('ScreenReaderFocusRegion', () => {
|
|
31
|
-
const element = _div || (_div =
|
|
31
|
+
const element = _div || (_div = _jsxs("div", {
|
|
32
32
|
"data-testid": "parent",
|
|
33
33
|
role: "main",
|
|
34
34
|
"aria-label": "test app",
|
|
35
|
-
id: "test-parent3"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
35
|
+
id: "test-parent3",
|
|
36
|
+
children: [_jsx("div", {
|
|
37
|
+
"data-testid": "ignore",
|
|
38
|
+
role: "alert",
|
|
39
|
+
children: _jsx("span", {
|
|
40
|
+
children: "test alert"
|
|
41
|
+
})
|
|
42
|
+
}), _jsxs("div", {
|
|
43
|
+
"data-testid": "child",
|
|
44
|
+
children: [_jsx("div", {
|
|
45
|
+
"data-testid": "descendant",
|
|
46
|
+
children: "foo"
|
|
47
|
+
}), _jsx("div", {
|
|
48
|
+
"data-testid": "descendant",
|
|
49
|
+
children: _jsx("div", {
|
|
50
|
+
"data-testid": "descendant",
|
|
51
|
+
children: "bar"
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
}), _jsxs("div", {
|
|
55
|
+
"data-testid": "parent",
|
|
56
|
+
"aria-hidden": "true",
|
|
57
|
+
id: "test-parent2",
|
|
58
|
+
children: [_jsx("div", {
|
|
59
|
+
"data-testid": "child"
|
|
60
|
+
}), _jsxs("div", {
|
|
61
|
+
role: "dialog",
|
|
62
|
+
"aria-label": "some content",
|
|
63
|
+
"data-testid": "parent",
|
|
64
|
+
id: "test-parent1",
|
|
65
|
+
children: [_jsxs("div", {
|
|
66
|
+
"data-testid": "content",
|
|
67
|
+
children: [_jsx("div", {
|
|
68
|
+
children: "Hello world"
|
|
69
|
+
}), _jsx("button", {
|
|
70
|
+
children: "click me"
|
|
71
|
+
}), _jsx("button", {
|
|
72
|
+
children: "or click me"
|
|
73
|
+
})]
|
|
74
|
+
}), _jsx("span", {
|
|
75
|
+
"data-testid": "child",
|
|
76
|
+
children: _jsxs("ul", {
|
|
77
|
+
"data-testid": "descendant",
|
|
78
|
+
children: [_jsx("li", {
|
|
79
|
+
"data-testid": "descendant",
|
|
80
|
+
children: "item 1"
|
|
81
|
+
}), _jsx("li", {
|
|
82
|
+
"data-testid": "descendant",
|
|
83
|
+
children: "item 2"
|
|
84
|
+
}), _jsx("li", {
|
|
85
|
+
"data-testid": "descendant",
|
|
86
|
+
children: "item 3"
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
})]
|
|
90
|
+
})]
|
|
91
|
+
}), _jsxs("div", {
|
|
92
|
+
"data-testid": "child-initial-hidden",
|
|
93
|
+
"aria-hidden": "true",
|
|
94
|
+
children: [_jsx("div", {
|
|
95
|
+
"data-testid": "descendant",
|
|
96
|
+
children: "foo"
|
|
97
|
+
}), _jsx("div", {
|
|
98
|
+
"data-testid": "descendant",
|
|
99
|
+
children: "bar"
|
|
100
|
+
})]
|
|
101
|
+
})]
|
|
102
|
+
}));
|
|
78
103
|
it('should accept a function for liveRegion', async () => {
|
|
79
104
|
render(element);
|
|
80
105
|
const ignore = screen.getByTestId('ignore');
|
|
@@ -177,18 +202,19 @@ describe('ScreenReaderFocusRegion', () => {
|
|
|
177
202
|
});
|
|
178
203
|
});
|
|
179
204
|
it('should not apply aria-hidden to elements that have aria-live attributes', async () => {
|
|
180
|
-
render(_div2 || (_div2 =
|
|
205
|
+
render(_div2 || (_div2 = _jsxs("div", {
|
|
181
206
|
"data-testid": "main",
|
|
182
207
|
role: "main",
|
|
183
|
-
"aria-label": "test app"
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
208
|
+
"aria-label": "test app",
|
|
209
|
+
children: [_jsx("div", {
|
|
210
|
+
"data-testid": "live",
|
|
211
|
+
"aria-live": "assertive"
|
|
212
|
+
}), _jsx("div", {
|
|
213
|
+
"data-testid": "regular"
|
|
214
|
+
}), _jsx("div", {
|
|
215
|
+
"data-testid": "content"
|
|
216
|
+
})]
|
|
217
|
+
})));
|
|
192
218
|
const content = screen.getByTestId('content');
|
|
193
219
|
const screenReaderFocusRegion = new ScreenReaderFocusRegion(content);
|
|
194
220
|
screenReaderFocusRegion.activate();
|
|
@@ -23,15 +23,19 @@ var _ScreenReaderContent, _div;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import '@testing-library/jest-dom';
|
|
28
27
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
29
28
|
import { hasVisibleChildren } from '../hasVisibleChildren';
|
|
29
|
+
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
30
30
|
describe('hasVisibleChildren', () => {
|
|
31
31
|
it('should not count ScreenReaderContent as visible content', async () => {
|
|
32
|
-
expect(hasVisibleChildren(_ScreenReaderContent || (_ScreenReaderContent =
|
|
32
|
+
expect(hasVisibleChildren(_ScreenReaderContent || (_ScreenReaderContent = _jsx(ScreenReaderContent, {
|
|
33
|
+
children: "Foo"
|
|
34
|
+
})))).toBe(false);
|
|
33
35
|
});
|
|
34
36
|
it('should count everything else as visible', async () => {
|
|
35
|
-
expect(hasVisibleChildren(_div || (_div =
|
|
37
|
+
expect(hasVisibleChildren(_div || (_div = _jsx("div", {
|
|
38
|
+
children: "Foo"
|
|
39
|
+
})))).toBe(true);
|
|
36
40
|
});
|
|
37
41
|
});
|
|
@@ -23,24 +23,27 @@ var _div, _div2, _div3;
|
|
|
23
23
|
* SOFTWARE.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
import React from 'react';
|
|
27
26
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
28
27
|
import { vi } from 'vitest';
|
|
29
28
|
import '@testing-library/jest-dom';
|
|
30
29
|
import { scopeTab } from '../scopeTab';
|
|
30
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
31
31
|
const MOCK_EVENT = new KeyboardEvent('mockEvent', {
|
|
32
32
|
shiftKey: false
|
|
33
33
|
});
|
|
34
34
|
MOCK_EVENT.preventDefault = () => {};
|
|
35
35
|
describe('scopeTab', () => {
|
|
36
36
|
it('should scope tab within container', async () => {
|
|
37
|
-
render(_div || (_div =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
render(_div || (_div = _jsx("div", {
|
|
38
|
+
children: _jsxs("div", {
|
|
39
|
+
"data-testid": "container",
|
|
40
|
+
children: [_jsx("input", {
|
|
41
|
+
"data-testid": "first"
|
|
42
|
+
}), _jsx("input", {
|
|
43
|
+
"data-testid": "second"
|
|
44
|
+
})]
|
|
45
|
+
})
|
|
46
|
+
})));
|
|
44
47
|
const container = screen.getByTestId('container');
|
|
45
48
|
const first = screen.getByTestId('first');
|
|
46
49
|
const second = screen.getByTestId('second');
|
|
@@ -54,9 +57,12 @@ describe('scopeTab', () => {
|
|
|
54
57
|
});
|
|
55
58
|
});
|
|
56
59
|
it('should not attempt scoping when no tabbable children', async () => {
|
|
57
|
-
render(_div2 || (_div2 =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
render(_div2 || (_div2 = _jsxs("div", {
|
|
61
|
+
children: [_jsx("div", {
|
|
62
|
+
"data-testid": "container",
|
|
63
|
+
children: "Hello"
|
|
64
|
+
}), _jsx("input", {})]
|
|
65
|
+
})));
|
|
60
66
|
const input = screen.getByRole('textbox');
|
|
61
67
|
const container = screen.getByTestId('container');
|
|
62
68
|
input.focus();
|
|
@@ -67,9 +73,12 @@ describe('scopeTab', () => {
|
|
|
67
73
|
});
|
|
68
74
|
it('should execute callback when provided instead of default behavior', async () => {
|
|
69
75
|
const cb = vi.fn();
|
|
70
|
-
render(_div3 || (_div3 =
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
render(_div3 || (_div3 = _jsx("div", {
|
|
77
|
+
children: _jsx("div", {
|
|
78
|
+
"data-testid": "container",
|
|
79
|
+
children: _jsx("input", {})
|
|
80
|
+
})
|
|
81
|
+
})));
|
|
73
82
|
const input = screen.getByRole('textbox');
|
|
74
83
|
const container = screen.getByTestId('container');
|
|
75
84
|
input.focus();
|
package/es/hasVisibleChildren.js
CHANGED
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
25
|
+
import { Children } from 'react';
|
|
26
26
|
import { matchComponentTypes } from '@instructure/ui-react-utils';
|
|
27
27
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content';
|
|
28
28
|
function hasVisibleChildren(children) {
|
|
29
29
|
let visible = false;
|
|
30
|
-
|
|
30
|
+
Children.forEach(children, child => {
|
|
31
31
|
if (child && !matchComponentTypes(child, [ScreenReaderContent])) {
|
|
32
32
|
visible = true;
|
|
33
33
|
}
|