@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 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-0](https://github.com/instructure/instructure-ui/compare/v10.16.0...v10.16.1-snapshot-0) (2025-04-15)
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
- import React from 'react';
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 = /*#__PURE__*/React.createElement("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
- }, /*#__PURE__*/React.createElement("div", {
40
- "data-test-ignore": true,
41
- role: "alert"
42
- }, /*#__PURE__*/React.createElement("span", null, "test alert")), /*#__PURE__*/React.createElement("div", {
43
- "data-test-child": true
44
- }, /*#__PURE__*/React.createElement("div", {
45
- "data-test-descendant": true
46
- }), /*#__PURE__*/React.createElement("div", {
47
- "data-test-descendant": true
48
- }, /*#__PURE__*/React.createElement("div", {
49
- "data-test-descendant": true
50
- }, /*#__PURE__*/React.createElement("button", {
51
- "data-testid": "button"
52
- }, "click me")))), /*#__PURE__*/React.createElement("div", {
53
- "data-test-parent": true,
54
- "aria-hidden": "true",
55
- id: "test-parent2"
56
- }, /*#__PURE__*/React.createElement("div", {
57
- "data-test-child": true
58
- }), /*#__PURE__*/React.createElement("div", {
59
- role: "dialog",
60
- "aria-label": "some content",
61
- "data-test-parent": true,
62
- id: "test-parent1"
63
- }, /*#__PURE__*/React.createElement("div", {
64
- "data-testid": "content"
65
- }, /*#__PURE__*/React.createElement("div", null, "Hello world"), /*#__PURE__*/React.createElement("button", {
66
- "data-testid": "first-tabbable"
67
- }, "click me"), /*#__PURE__*/React.createElement("button", null, "or click me")), /*#__PURE__*/React.createElement("span", {
68
- "data-test-child": true
69
- }, /*#__PURE__*/React.createElement("ul", {
70
- "data-test-descendant": true
71
- }, /*#__PURE__*/React.createElement("li", {
72
- "data-test-descendant": true
73
- }, "item 1"), /*#__PURE__*/React.createElement("li", {
74
- "data-test-descendant": true
75
- }, "item 2"), /*#__PURE__*/React.createElement("li", {
76
- "data-test-descendant": true
77
- }, "item 3"))))), /*#__PURE__*/React.createElement("div", {
78
- "data-test-child": true,
79
- "aria-hidden": "true"
80
- }, /*#__PURE__*/React.createElement("div", {
81
- "data-test-descendant": true
82
- }), /*#__PURE__*/React.createElement("div", {
83
- "data-test-descendant": true
84
- })), /*#__PURE__*/React.createElement("iframe", {
85
- id: "frame",
86
- title: "frame"
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 = /*#__PURE__*/React.createElement("div", {
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
- }, /*#__PURE__*/React.createElement("div", {
105
- "data-test-ignore": true,
106
- role: "alert"
107
- }, /*#__PURE__*/React.createElement("span", null, "test alert")), /*#__PURE__*/React.createElement("div", {
108
- "data-test-child": true
109
- }, /*#__PURE__*/React.createElement("div", {
110
- "data-test-descendant": true
111
- }), /*#__PURE__*/React.createElement("div", {
112
- "data-test-descendant": true
113
- }, /*#__PURE__*/React.createElement("div", {
114
- "data-test-descendant": true
115
- }, /*#__PURE__*/React.createElement("button", {
116
- "data-testid": "button"
117
- }, "click me")))), /*#__PURE__*/React.createElement("div", {
118
- "data-test-parent": true,
119
- "aria-hidden": "true",
120
- id: "test-parent2"
121
- }, /*#__PURE__*/React.createElement("div", {
122
- "data-test-child": true
123
- }), /*#__PURE__*/React.createElement("div", {
124
- role: "dialog",
125
- "aria-label": "some content",
126
- "data-test-parent": true,
127
- id: "test-parent1"
128
- }, /*#__PURE__*/React.createElement("div", {
129
- "data-testid": "content"
130
- }, /*#__PURE__*/React.createElement("div", null, "Hello world"), /*#__PURE__*/React.createElement("button", {
131
- "data-test-first-tabbable": true
132
- }, "click me"), /*#__PURE__*/React.createElement("button", null, "or click me")), /*#__PURE__*/React.createElement("span", {
133
- "data-test-child": true
134
- }, /*#__PURE__*/React.createElement("ul", {
135
- "data-test-descendant": true
136
- }, /*#__PURE__*/React.createElement("li", {
137
- "data-test-descendant": true
138
- }, "item 1"), /*#__PURE__*/React.createElement("li", {
139
- "data-test-descendant": true
140
- }, "item 2"), /*#__PURE__*/React.createElement("li", {
141
- "data-test-descendant": true
142
- }, "item 3"))))), /*#__PURE__*/React.createElement("div", {
143
- "data-test-child": true,
144
- "aria-hidden": "true"
145
- }, /*#__PURE__*/React.createElement("div", {
146
- "data-test-descendant": true
147
- }), /*#__PURE__*/React.createElement("div", {
148
- "data-test-descendant": true
149
- })), /*#__PURE__*/React.createElement("iframe", {
150
- id: "frame",
151
- title: "frame"
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 = /*#__PURE__*/React.createElement("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
- }, /*#__PURE__*/React.createElement("div", {
37
- "data-testid": "ignore",
38
- role: "alert"
39
- }, /*#__PURE__*/React.createElement("span", null, "test alert")), /*#__PURE__*/React.createElement("div", {
40
- "data-testid": "child"
41
- }, /*#__PURE__*/React.createElement("div", {
42
- "data-testid": "descendant"
43
- }, "foo"), /*#__PURE__*/React.createElement("div", {
44
- "data-testid": "descendant"
45
- }, /*#__PURE__*/React.createElement("div", {
46
- "data-testid": "descendant"
47
- }, "bar"))), /*#__PURE__*/React.createElement("div", {
48
- "data-testid": "parent",
49
- "aria-hidden": "true",
50
- id: "test-parent2"
51
- }, /*#__PURE__*/React.createElement("div", {
52
- "data-testid": "child"
53
- }), /*#__PURE__*/React.createElement("div", {
54
- role: "dialog",
55
- "aria-label": "some content",
56
- "data-testid": "parent",
57
- id: "test-parent1"
58
- }, /*#__PURE__*/React.createElement("div", {
59
- "data-testid": "content"
60
- }, /*#__PURE__*/React.createElement("div", null, "Hello world"), /*#__PURE__*/React.createElement("button", null, "click me"), /*#__PURE__*/React.createElement("button", null, "or click me")), /*#__PURE__*/React.createElement("span", {
61
- "data-testid": "child"
62
- }, /*#__PURE__*/React.createElement("ul", {
63
- "data-testid": "descendant"
64
- }, /*#__PURE__*/React.createElement("li", {
65
- "data-testid": "descendant"
66
- }, "item 1"), /*#__PURE__*/React.createElement("li", {
67
- "data-testid": "descendant"
68
- }, "item 2"), /*#__PURE__*/React.createElement("li", {
69
- "data-testid": "descendant"
70
- }, "item 3"))))), /*#__PURE__*/React.createElement("div", {
71
- "data-testid": "child-initial-hidden",
72
- "aria-hidden": "true"
73
- }, /*#__PURE__*/React.createElement("div", {
74
- "data-testid": "descendant"
75
- }, "foo"), /*#__PURE__*/React.createElement("div", {
76
- "data-testid": "descendant"
77
- }, "bar"))));
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 = /*#__PURE__*/React.createElement("div", {
205
+ render(_div2 || (_div2 = _jsxs("div", {
181
206
  "data-testid": "main",
182
207
  role: "main",
183
- "aria-label": "test app"
184
- }, /*#__PURE__*/React.createElement("div", {
185
- "data-testid": "live",
186
- "aria-live": "assertive"
187
- }), /*#__PURE__*/React.createElement("div", {
188
- "data-testid": "regular"
189
- }), /*#__PURE__*/React.createElement("div", {
190
- "data-testid": "content"
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 = /*#__PURE__*/React.createElement(ScreenReaderContent, null, "Foo")))).toBe(false);
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 = /*#__PURE__*/React.createElement("div", null, "Foo")))).toBe(true);
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 = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
38
- "data-testid": "container"
39
- }, /*#__PURE__*/React.createElement("input", {
40
- "data-testid": "first"
41
- }), /*#__PURE__*/React.createElement("input", {
42
- "data-testid": "second"
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 = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
58
- "data-testid": "container"
59
- }, "Hello"), /*#__PURE__*/React.createElement("input", null))));
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 = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
71
- "data-testid": "container"
72
- }, /*#__PURE__*/React.createElement("input", null)))));
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();
@@ -22,12 +22,12 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import React from 'react';
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
- React.Children.forEach(children, child => {
30
+ Children.forEach(children, child => {
31
31
  if (child && !matchComponentTypes(child, [ScreenReaderContent])) {
32
32
  visible = true;
33
33
  }