@instructure/ui-form-field 11.7.4-snapshot-121 → 11.7.4-snapshot-125

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,11 +3,12 @@
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
- ## [11.7.4-snapshot-121](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-121) (2026-07-22)
6
+ ## [11.7.4-snapshot-125](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4-snapshot-125) (2026-07-22)
7
7
 
8
8
 
9
9
  ### Bug Fixes
10
10
 
11
+ * **many:** keep form field messages out of the control's accessible name ([409d077](https://github.com/instructure/instructure-ui/commit/409d077a3095b318fd7d2e150bb01bc2732c9bf5))
11
12
  * **ui-form-field:** disable child inputs when FormFieldGroup is disabled ([d30fc64](https://github.com/instructure/instructure-ui/commit/d30fc642a3586f708d86ab570ae73086107e2695))
12
13
 
13
14
 
@@ -22,5 +22,5 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- const allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
25
+ const allowedProps = ['label', 'id', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
26
26
  export { allowedProps };
@@ -45,6 +45,7 @@ const FormFieldLayout = /*#__PURE__*/forwardRef((props, ref) => {
45
45
  label,
46
46
  messages,
47
47
  messagesId: messagesIdProp,
48
+ labelId: labelIdProp,
48
49
  children,
49
50
  width,
50
51
  elementRef,
@@ -65,7 +66,9 @@ const FormFieldLayout = /*#__PURE__*/forwardRef((props, ref) => {
65
66
  setDeterministicId(getId());
66
67
  }, []);
67
68
  const messagesId = messagesIdProp || deterministicId;
68
- const labelId = deterministicId ? `${deterministicId}-Label` : undefined;
69
+ // Give the label an id so controls can reference only the label text via
70
+ // `aria-labelledby`, keeping messages out of the accessible name.
71
+ const labelId = labelIdProp || (deterministicId ? `${deterministicId}-Label` : undefined);
69
72
 
70
73
  // Filter out error and success messages when disabled or readOnly
71
74
  const filteredMessages = disabled || readOnly ? messages?.filter(msg => msg.type !== 'error' && msg.type !== 'newError' && msg.type !== 'success') : messages;
@@ -145,6 +148,7 @@ const FormFieldLayout = /*#__PURE__*/forwardRef((props, ref) => {
145
148
  }
146
149
  return _jsx("span", {
147
150
  css: styles?.formFieldLabel,
151
+ id: labelId,
148
152
  children: labelContent
149
153
  });
150
154
  } else if (label) {
@@ -22,5 +22,5 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
25
+ const allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
26
26
  export { allowedProps };
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
28
28
  * SOFTWARE.
29
29
  */
30
30
 
31
- const allowedProps = exports.allowedProps = ['label', 'id', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
31
+ const allowedProps = exports.allowedProps = ['label', 'id', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'vAlign', 'width', 'inputContainerRef', 'elementRef', 'isRequired', 'margin', 'disabled', 'readOnly'];
@@ -60,6 +60,7 @@ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwar
60
60
  label,
61
61
  messages,
62
62
  messagesId: messagesIdProp,
63
+ labelId: labelIdProp,
63
64
  children,
64
65
  width,
65
66
  elementRef,
@@ -80,7 +81,9 @@ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwar
80
81
  setDeterministicId(getId());
81
82
  }, []);
82
83
  const messagesId = messagesIdProp || deterministicId;
83
- const labelId = deterministicId ? `${deterministicId}-Label` : undefined;
84
+ // Give the label an id so controls can reference only the label text via
85
+ // `aria-labelledby`, keeping messages out of the accessible name.
86
+ const labelId = labelIdProp || (deterministicId ? `${deterministicId}-Label` : undefined);
84
87
 
85
88
  // Filter out error and success messages when disabled or readOnly
86
89
  const filteredMessages = disabled || readOnly ? messages?.filter(msg => msg.type !== 'error' && msg.type !== 'newError' && msg.type !== 'success') : messages;
@@ -160,6 +163,7 @@ const FormFieldLayout = exports.FormFieldLayout = /*#__PURE__*/(0, _react.forwar
160
163
  }
161
164
  return (0, _jsxRuntime.jsx)("span", {
162
165
  css: styles?.formFieldLabel,
166
+ id: labelId,
163
167
  children: labelContent
164
168
  });
165
169
  } else if (label) {
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
28
28
  * SOFTWARE.
29
29
  */
30
30
 
31
- const allowedProps = exports.allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
31
+ const allowedProps = exports.allowedProps = ['label', 'id', 'as', 'messages', 'messagesId', 'labelId', 'children', 'inline', 'layout', 'labelAlign', 'width', 'inputContainerRef', 'elementRef', 'margin', 'vAlign', 'isRequired', 'disabled', 'readOnly'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-form-field",
3
- "version": "11.7.4-snapshot-121",
3
+ "version": "11.7.4-snapshot-125",
4
4
  "description": "Form layout components.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,24 +15,24 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.29.7",
18
- "@instructure/console": "11.7.4-snapshot-121",
19
- "@instructure/emotion": "11.7.4-snapshot-121",
20
- "@instructure/ui-a11y-content": "11.7.4-snapshot-121",
21
- "@instructure/ui-a11y-utils": "11.7.4-snapshot-121",
22
- "@instructure/ui-grid": "11.7.4-snapshot-121",
23
- "@instructure/shared-types": "11.7.4-snapshot-121",
24
- "@instructure/ui-icons": "11.7.4-snapshot-121",
25
- "@instructure/ui-themes": "11.7.4-snapshot-121",
26
- "@instructure/ui-react-utils": "11.7.4-snapshot-121",
27
- "@instructure/uid": "11.7.4-snapshot-121",
28
- "@instructure/ui-utils": "11.7.4-snapshot-121"
18
+ "@instructure/console": "11.7.4-snapshot-125",
19
+ "@instructure/emotion": "11.7.4-snapshot-125",
20
+ "@instructure/ui-a11y-content": "11.7.4-snapshot-125",
21
+ "@instructure/ui-a11y-utils": "11.7.4-snapshot-125",
22
+ "@instructure/shared-types": "11.7.4-snapshot-125",
23
+ "@instructure/ui-grid": "11.7.4-snapshot-125",
24
+ "@instructure/ui-icons": "11.7.4-snapshot-125",
25
+ "@instructure/ui-react-utils": "11.7.4-snapshot-125",
26
+ "@instructure/ui-themes": "11.7.4-snapshot-125",
27
+ "@instructure/uid": "11.7.4-snapshot-125",
28
+ "@instructure/ui-utils": "11.7.4-snapshot-125"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@testing-library/jest-dom": "^6.9.1",
32
32
  "@testing-library/react": "16.3.2",
33
33
  "vitest": "^4.1.9",
34
- "@instructure/ui-axe-check": "11.7.4-snapshot-121",
35
- "@instructure/ui-babel-preset": "11.7.4-snapshot-121"
34
+ "@instructure/ui-axe-check": "11.7.4-snapshot-125",
35
+ "@instructure/ui-babel-preset": "11.7.4-snapshot-125"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": ">=18 <=19"
@@ -46,6 +46,11 @@ type FormFieldOwnProps = {
46
46
  * id for the form field messages
47
47
  */
48
48
  messagesId?: string
49
+ /**
50
+ * id for the label element, so a single form control can reference just the
51
+ * label text via `aria-labelledby` (keeping messages out of its accessible name)
52
+ */
53
+ labelId?: string
49
54
  children?: React.ReactNode
50
55
  inline?: boolean
51
56
  layout?: 'stacked' | 'inline'
@@ -86,6 +91,7 @@ const allowedProps: AllowedPropKeys = [
86
91
  'id',
87
92
  'messages',
88
93
  'messagesId',
94
+ 'labelId',
89
95
  'children',
90
96
  'inline',
91
97
  'layout',
@@ -48,6 +48,7 @@ const FormFieldLayout = forwardRef<Element, FormFieldLayoutProps>(
48
48
  label,
49
49
  messages,
50
50
  messagesId: messagesIdProp,
51
+ labelId: labelIdProp,
51
52
  children,
52
53
  width,
53
54
  elementRef,
@@ -69,7 +70,10 @@ const FormFieldLayout = forwardRef<Element, FormFieldLayoutProps>(
69
70
  }, [])
70
71
 
71
72
  const messagesId = messagesIdProp || deterministicId
72
- const labelId = deterministicId ? `${deterministicId}-Label` : undefined
73
+ // Give the label an id so controls can reference only the label text via
74
+ // `aria-labelledby`, keeping messages out of the accessible name.
75
+ const labelId =
76
+ labelIdProp || (deterministicId ? `${deterministicId}-Label` : undefined)
73
77
 
74
78
  // Filter out error and success messages when disabled or readOnly
75
79
  const filteredMessages =
@@ -183,7 +187,11 @@ const FormFieldLayout = forwardRef<Element, FormFieldLayoutProps>(
183
187
  </legend>
184
188
  )
185
189
  }
186
- return <span css={styles?.formFieldLabel}>{labelContent}</span>
190
+ return (
191
+ <span css={styles?.formFieldLabel} id={labelId}>
192
+ {labelContent}
193
+ </span>
194
+ )
187
195
  } else if (label) {
188
196
  if (ElementType === 'fieldset') {
189
197
  return (
@@ -56,6 +56,11 @@ type FormFieldLayoutOwnProps = {
56
56
  * id for the form field messages
57
57
  */
58
58
  messagesId?: string
59
+ /**
60
+ * id for the label element, so a single form control can reference just the
61
+ * label text via `aria-labelledby` (keeping messages out of its accessible name)
62
+ */
63
+ labelId?: string
59
64
  children?: React.ReactNode
60
65
  /**
61
66
  * If `true` use an inline layout -- content will flow on the left/right side
@@ -129,6 +134,7 @@ const allowedProps: AllowedPropKeys = [
129
134
  'as',
130
135
  'messages',
131
136
  'messagesId',
137
+ 'labelId',
132
138
  'children',
133
139
  'inline',
134
140
  'layout',