@recursica/mantine-adapter 0.50.5 → 0.50.6
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/package.json
CHANGED
|
@@ -51,6 +51,7 @@ export const FormControlWrapper = forwardRef<
|
|
|
51
51
|
// Generate a reliable ID to map the Label's HTML context down to the component array natively.
|
|
52
52
|
const generatedId = useId();
|
|
53
53
|
const id = userProvidedId || `recursica-fc-${generatedId}`;
|
|
54
|
+
const labelId = `${id}-label`;
|
|
54
55
|
|
|
55
56
|
// Evaluate explicit assistive fallbacks ensuring assistiveText correctly prioritizes natively over underlying Mantine configurations!
|
|
56
57
|
const resolvedAssistive = assistiveText || description;
|
|
@@ -67,11 +68,15 @@ export const FormControlWrapper = forwardRef<
|
|
|
67
68
|
? `${rootClass} ${classNameProp}`
|
|
68
69
|
: rootClass;
|
|
69
70
|
|
|
70
|
-
// Clone ARIA identifiers directly back down into the nested children wrapper so screen-readers natively hook the external strings
|
|
71
|
+
// Clone ARIA identifiers directly back down into the nested children wrapper so screen-readers natively hook the external strings.
|
|
72
|
+
// `id` is cloned down here too — the label's `htmlFor` below only resolves to the field's
|
|
73
|
+
// native `label.control` when the field itself actually carries this id.
|
|
71
74
|
const content = React.isValidElement(children)
|
|
72
75
|
? React.cloneElement(
|
|
73
76
|
children as React.ReactElement<Record<string, unknown>>,
|
|
74
77
|
{
|
|
78
|
+
...(!(children.props as Record<string, unknown>)["id"] ? { id } : {}),
|
|
79
|
+
"aria-labelledby": labelId,
|
|
75
80
|
...(resolvedAssistive &&
|
|
76
81
|
!(children.props as Record<string, unknown>)["aria-describedby"]
|
|
77
82
|
? { "aria-describedby": assistiveId }
|
|
@@ -86,7 +91,8 @@ export const FormControlWrapper = forwardRef<
|
|
|
86
91
|
|
|
87
92
|
const labelNode = label ? (
|
|
88
93
|
<Label
|
|
89
|
-
id={
|
|
94
|
+
id={labelId}
|
|
95
|
+
htmlFor={id} // Native label/control association — must not also be set on the label's own id
|
|
90
96
|
labelAlignment={labelAlignment}
|
|
91
97
|
labelOptionalText={labelOptionalText}
|
|
92
98
|
labelWithEditIcon={labelWithEditIcon}
|