@dloizides/ui-forms 1.18.2 → 1.18.3

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
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.18.3
4
+
5
+ **FormCheckbox: the hint/description is now announced by screen readers.**
6
+
7
+ The hint Text gets a stable per-instance id (`useFieldIds().hintId`, as `Field` does) and the role=checkbox
8
+ Pressable sets `aria-describedby` to it when a hint is present; with no hint the attribute is omitted.
9
+
3
10
  ## 1.18.2
4
11
 
5
12
  **FormSwitch: the switch now sits in a 44x44 (MIN_TOUCH_TARGET_PX) pressable slot on web.**
package/dist/index.js CHANGED
@@ -1413,6 +1413,7 @@ var FormCheckbox = ({
1413
1413
  const brand = palette.primary["500"];
1414
1414
  const hintText = typeof hint === "string" && hint !== "" ? hint : description;
1415
1415
  const hasHint = typeof hintText === "string" && hintText !== "";
1416
+ const { hintId } = useFieldIds();
1416
1417
  const themeStyles = React2__default.default.useMemo(() => {
1417
1418
  const boxOn = { backgroundColor: brand, borderColor: brand };
1418
1419
  const boxOff = { backgroundColor: "transparent", borderColor: colors.border };
@@ -1441,6 +1442,7 @@ var FormCheckbox = ({
1441
1442
  accessibilityRole: "checkbox",
1442
1443
  accessibilityState: { checked: value, disabled },
1443
1444
  "aria-checked": value,
1445
+ "aria-describedby": hasHint ? hintId : void 0,
1444
1446
  disabled,
1445
1447
  onPress: toggle,
1446
1448
  role: "checkbox",
@@ -1456,7 +1458,7 @@ var FormCheckbox = ({
1456
1458
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: [styles7.box, value ? themeStyles.boxOn : themeStyles.boxOff], children: value ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.check, { color: colors.surface }], accessibilityElementsHidden: true, children: "\u2713" }) : null }),
1457
1459
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.textColumn, children: [
1458
1460
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.label, themeStyles.label], children: label }),
1459
- hasHint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.hint, themeStyles.hint], children: hintText }) : null
1461
+ hasHint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { nativeID: hintId, style: [styles7.hint, themeStyles.hint], children: hintText }) : null
1460
1462
  ] })
1461
1463
  ]
1462
1464
  }