@dloizides/ui-forms 1.18.2 → 1.18.4

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
@@ -871,8 +871,11 @@ function RecentInputField({
871
871
  );
872
872
  const handleBlur = React2.useCallback(
873
873
  (event) => {
874
- if (latestText.current.trim() !== "") remember(latestText.current);
875
- setTimeout(() => setIsOpen(false), CLOSE_DELAY_MS);
874
+ const blurredText = latestText.current;
875
+ setTimeout(() => {
876
+ setIsOpen(false);
877
+ if (blurredText.trim() !== "") remember(blurredText);
878
+ }, CLOSE_DELAY_MS);
876
879
  onBlur?.(event);
877
880
  },
878
881
  [remember, onBlur]
@@ -1413,6 +1416,7 @@ var FormCheckbox = ({
1413
1416
  const brand = palette.primary["500"];
1414
1417
  const hintText = typeof hint === "string" && hint !== "" ? hint : description;
1415
1418
  const hasHint = typeof hintText === "string" && hintText !== "";
1419
+ const { hintId } = useFieldIds();
1416
1420
  const themeStyles = React2__default.default.useMemo(() => {
1417
1421
  const boxOn = { backgroundColor: brand, borderColor: brand };
1418
1422
  const boxOff = { backgroundColor: "transparent", borderColor: colors.border };
@@ -1441,6 +1445,7 @@ var FormCheckbox = ({
1441
1445
  accessibilityRole: "checkbox",
1442
1446
  accessibilityState: { checked: value, disabled },
1443
1447
  "aria-checked": value,
1448
+ "aria-describedby": hasHint ? hintId : void 0,
1444
1449
  disabled,
1445
1450
  onPress: toggle,
1446
1451
  role: "checkbox",
@@ -1456,7 +1461,7 @@ var FormCheckbox = ({
1456
1461
  /* @__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
1462
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.textColumn, children: [
1458
1463
  /* @__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
1464
+ hasHint ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { nativeID: hintId, style: [styles7.hint, themeStyles.hint], children: hintText }) : null
1460
1465
  ] })
1461
1466
  ]
1462
1467
  }