@instructure/ui-checkbox 9.10.2 → 9.11.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,6 +3,25 @@
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
+ ## [9.11.1](https://github.com/instructure/instructure-ui/compare/v9.11.0...v9.11.1) (2025-03-11)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix FormFieldLabel not read on NVDA hover ([c29b6ab](https://github.com/instructure/instructure-ui/commit/c29b6ab989266c6a7875e3f0dbdee3efbf18606a))
12
+
13
+
14
+
15
+
16
+
17
+ # [9.11.0](https://github.com/instructure/instructure-ui/compare/v9.10.2...v9.11.0) (2025-02-12)
18
+
19
+ **Note:** Version bump only for package @instructure/ui-checkbox
20
+
21
+
22
+
23
+
24
+
6
25
  ## [9.10.2](https://github.com/instructure/instructure-ui/compare/v9.10.1...v9.10.2) (2024-12-19)
7
26
 
8
27
  **Note:** Version bump only for package @instructure/ui-checkbox
@@ -81,8 +81,8 @@ describe('<CheckboxGroup />', () => {
81
81
  }]
82
82
  }),
83
83
  container = _renderCheckboxGroup.container;
84
- const fieldset = screen.getByRole('group');
85
- const ariaDesc = fieldset.getAttribute('aria-describedby');
84
+ const group = screen.getByRole('group');
85
+ const ariaDesc = group.getAttribute('aria-describedby');
86
86
  const messageById = container.querySelector(`[id="${ariaDesc}"]`);
87
87
  expect(messageById).toBeInTheDocument();
88
88
  expect(messageById).toHaveTextContent(TEST_ERROR_MESSAGE);
@@ -92,7 +92,7 @@ describe('<CheckboxGroup />', () => {
92
92
  description: TEST_DESCRIPTION
93
93
  }),
94
94
  container = _renderCheckboxGroup2.container;
95
- const legend = container.querySelector('legend');
95
+ const legend = container.querySelector('span[class$="-formFieldLayout__label"]');
96
96
  expect(legend).toBeInTheDocument();
97
97
  expect(legend).toHaveTextContent(TEST_DESCRIPTION);
98
98
  });
@@ -204,5 +204,22 @@ describe('<CheckboxGroup />', () => {
204
204
  const axeCheck = await runAxeCheck(container);
205
205
  expect(axeCheck).toBe(true);
206
206
  });
207
+ it('adds the correct ARIA attributes', () => {
208
+ const _renderCheckboxGroup4 = renderCheckboxGroup({
209
+ disabled: true,
210
+ messages: [{
211
+ type: 'newError',
212
+ text: 'abc'
213
+ }],
214
+ // @ts-ignore This is a valid attribute
215
+ 'data-id': 'group'
216
+ }),
217
+ container = _renderCheckboxGroup4.container;
218
+ const group = container.querySelector(`[data-id="group"]`);
219
+ expect(group).toBeInTheDocument();
220
+ expect(group).toHaveAttribute('aria-disabled', 'true');
221
+ // ARIA role 'group' cannot have the 'aria-invalid' attribute
222
+ expect(group).not.toHaveAttribute('aria-invalid');
223
+ });
207
224
  });
208
225
  });
@@ -83,8 +83,8 @@ describe('<CheckboxGroup />', () => {
83
83
  }]
84
84
  }),
85
85
  container = _renderCheckboxGroup.container;
86
- const fieldset = _react2.screen.getByRole('group');
87
- const ariaDesc = fieldset.getAttribute('aria-describedby');
86
+ const group = _react2.screen.getByRole('group');
87
+ const ariaDesc = group.getAttribute('aria-describedby');
88
88
  const messageById = container.querySelector(`[id="${ariaDesc}"]`);
89
89
  expect(messageById).toBeInTheDocument();
90
90
  expect(messageById).toHaveTextContent(TEST_ERROR_MESSAGE);
@@ -94,7 +94,7 @@ describe('<CheckboxGroup />', () => {
94
94
  description: TEST_DESCRIPTION
95
95
  }),
96
96
  container = _renderCheckboxGroup2.container;
97
- const legend = container.querySelector('legend');
97
+ const legend = container.querySelector('span[class$="-formFieldLayout__label"]');
98
98
  expect(legend).toBeInTheDocument();
99
99
  expect(legend).toHaveTextContent(TEST_DESCRIPTION);
100
100
  });
@@ -206,5 +206,22 @@ describe('<CheckboxGroup />', () => {
206
206
  const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
207
207
  expect(axeCheck).toBe(true);
208
208
  });
209
+ it('adds the correct ARIA attributes', () => {
210
+ const _renderCheckboxGroup4 = renderCheckboxGroup({
211
+ disabled: true,
212
+ messages: [{
213
+ type: 'newError',
214
+ text: 'abc'
215
+ }],
216
+ // @ts-ignore This is a valid attribute
217
+ 'data-id': 'group'
218
+ }),
219
+ container = _renderCheckboxGroup4.container;
220
+ const group = container.querySelector(`[data-id="group"]`);
221
+ expect(group).toBeInTheDocument();
222
+ expect(group).toHaveAttribute('aria-disabled', 'true');
223
+ // ARIA role 'group' cannot have the 'aria-invalid' attribute
224
+ expect(group).not.toHaveAttribute('aria-invalid');
225
+ });
209
226
  });
210
227
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "9.10.2",
3
+ "version": "9.11.1",
4
4
  "description": " styled HTML input type='checkbox' component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,28 +24,28 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.24.5",
27
- "@instructure/console": "9.10.2",
28
- "@instructure/emotion": "9.10.2",
29
- "@instructure/shared-types": "9.10.2",
30
- "@instructure/ui-dom-utils": "9.10.2",
31
- "@instructure/ui-form-field": "9.10.2",
32
- "@instructure/ui-icons": "9.10.2",
33
- "@instructure/ui-prop-types": "9.10.2",
34
- "@instructure/ui-react-utils": "9.10.2",
35
- "@instructure/ui-svg-images": "9.10.2",
36
- "@instructure/ui-testable": "9.10.2",
37
- "@instructure/ui-utils": "9.10.2",
38
- "@instructure/ui-view": "9.10.2",
39
- "@instructure/uid": "9.10.2",
27
+ "@instructure/console": "9.11.1",
28
+ "@instructure/emotion": "9.11.1",
29
+ "@instructure/shared-types": "9.11.1",
30
+ "@instructure/ui-dom-utils": "9.11.1",
31
+ "@instructure/ui-form-field": "9.11.1",
32
+ "@instructure/ui-icons": "9.11.1",
33
+ "@instructure/ui-prop-types": "9.11.1",
34
+ "@instructure/ui-react-utils": "9.11.1",
35
+ "@instructure/ui-svg-images": "9.11.1",
36
+ "@instructure/ui-testable": "9.11.1",
37
+ "@instructure/ui-utils": "9.11.1",
38
+ "@instructure/ui-view": "9.11.1",
39
+ "@instructure/uid": "9.11.1",
40
40
  "keycode": "^2",
41
41
  "prop-types": "^15.8.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@instructure/ui-axe-check": "9.10.2",
45
- "@instructure/ui-babel-preset": "9.10.2",
46
- "@instructure/ui-color-utils": "9.10.2",
47
- "@instructure/ui-test-utils": "9.10.2",
48
- "@instructure/ui-themes": "9.10.2",
44
+ "@instructure/ui-axe-check": "9.11.1",
45
+ "@instructure/ui-babel-preset": "9.11.1",
46
+ "@instructure/ui-color-utils": "9.11.1",
47
+ "@instructure/ui-test-utils": "9.11.1",
48
+ "@instructure/ui-themes": "9.11.1",
49
49
  "@testing-library/jest-dom": "^6.4.6",
50
50
  "@testing-library/react": "^15.0.7",
51
51
  "@testing-library/user-event": "^14.5.2",
@@ -88,8 +88,8 @@ describe('<CheckboxGroup />', () => {
88
88
  const { container } = renderCheckboxGroup({
89
89
  messages: [{ text: TEST_ERROR_MESSAGE, type: 'error' }]
90
90
  })
91
- const fieldset = screen.getByRole('group')
92
- const ariaDesc = fieldset.getAttribute('aria-describedby')
91
+ const group = screen.getByRole('group')
92
+ const ariaDesc = group.getAttribute('aria-describedby')
93
93
  const messageById = container.querySelector(`[id="${ariaDesc}"]`)
94
94
 
95
95
  expect(messageById).toBeInTheDocument()
@@ -98,7 +98,9 @@ describe('<CheckboxGroup />', () => {
98
98
 
99
99
  it('displays description message inside the legend', () => {
100
100
  const { container } = renderCheckboxGroup({ description: TEST_DESCRIPTION })
101
- const legend = container.querySelector('legend')
101
+ const legend = container.querySelector(
102
+ 'span[class$="-formFieldLayout__label"]'
103
+ )
102
104
 
103
105
  expect(legend).toBeInTheDocument()
104
106
  expect(legend).toHaveTextContent(TEST_DESCRIPTION)
@@ -217,5 +219,19 @@ describe('<CheckboxGroup />', () => {
217
219
 
218
220
  expect(axeCheck).toBe(true)
219
221
  })
222
+
223
+ it('adds the correct ARIA attributes', () => {
224
+ const { container } = renderCheckboxGroup({
225
+ disabled: true,
226
+ messages: [{ type: 'newError', text: 'abc' }],
227
+ // @ts-ignore This is a valid attribute
228
+ 'data-id': 'group'
229
+ })
230
+ const group = container.querySelector(`[data-id="group"]`)
231
+ expect(group).toBeInTheDocument()
232
+ expect(group).toHaveAttribute('aria-disabled', 'true')
233
+ // ARIA role 'group' cannot have the 'aria-invalid' attribute
234
+ expect(group).not.toHaveAttribute('aria-invalid')
235
+ })
220
236
  })
221
237
  })
@@ -22,7 +22,7 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import React from 'react'
25
+ import React, { type InputHTMLAttributes } from 'react'
26
26
  import PropTypes from 'prop-types'
27
27
 
28
28
  import { FormPropTypes } from '@instructure/ui-form-field'
@@ -32,7 +32,10 @@ import {
32
32
  } from '@instructure/ui-prop-types'
33
33
 
34
34
  import type { FormMessage } from '@instructure/ui-form-field'
35
- import type { PropValidators } from '@instructure/shared-types'
35
+ import type {
36
+ OtherHTMLAttributes,
37
+ PropValidators
38
+ } from '@instructure/shared-types'
36
39
  import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
37
40
 
38
41
  import { Checkbox } from '../Checkbox'
@@ -58,7 +61,12 @@ type PropKeys = keyof CheckboxGroupOwnProps
58
61
 
59
62
  type AllowedPropKeys = Readonly<Array<PropKeys>>
60
63
 
61
- type CheckboxGroupProps = CheckboxGroupOwnProps & WithDeterministicIdProps
64
+ type CheckboxGroupProps = CheckboxGroupOwnProps &
65
+ OtherHTMLAttributes<
66
+ CheckboxGroupOwnProps,
67
+ InputHTMLAttributes<CheckboxGroupOwnProps & Element>
68
+ > &
69
+ WithDeterministicIdProps
62
70
 
63
71
  const propTypes: PropValidators<PropKeys> = {
64
72
  name: PropTypes.string.isRequired,