@dloizides/ui-forms 1.18.1 → 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,22 @@
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
+
10
+ ## 1.18.2
11
+
12
+ **FormSwitch: the switch now sits in a 44x44 (MIN_TOUCH_TARGET_PX) pressable slot on web.**
13
+
14
+ Visual QA on kefi-web Site settings (360 and 1280) measured the switch at 40x20: react-native-web sizes the
15
+ native input to the Switch root, and `hitSlop` is inert on web. The switch is now centred in a slot with
16
+ `minWidth`/`minHeight` MIN_TOUCH_TARGET_PX inside the pressable row, so the row stays at least 44 tall even when a
17
+ `containerStyle` overrides `minHeight`. The track and thumb are unchanged; the switch gains a few px of horizontal gutter.
18
+ New testID: `<testID>-hitbox`.
19
+
3
20
  ## 1.17.0
4
21
 
5
22
  **Chips now have a 44px minimum touch target on web. `hitSlop` never did that — it is native-only.**
package/dist/index.js CHANGED
@@ -1273,6 +1273,12 @@ var styles6 = reactNative.StyleSheet.create({
1273
1273
  // `hitSlop`, so a pointer target smaller than the floor cannot be widened any other way.
1274
1274
  minHeight: a11y.MIN_TOUCH_TARGET_PX
1275
1275
  },
1276
+ switchSlot: {
1277
+ minWidth: a11y.MIN_TOUCH_TARGET_PX,
1278
+ minHeight: a11y.MIN_TOUCH_TARGET_PX,
1279
+ alignItems: "center",
1280
+ justifyContent: "center"
1281
+ },
1276
1282
  textColumn: {
1277
1283
  flex: 1
1278
1284
  },
@@ -1326,7 +1332,7 @@ var FormSwitch = ({
1326
1332
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.label, themeStyles.label], children: label }),
1327
1333
  hasDescription ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles6.description, themeStyles.description], children: description }) : null
1328
1334
  ] }),
1329
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { pointerEvents: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
1335
+ /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { pointerEvents: "none", style: styles6.switchSlot, testID: `${testID}-hitbox`, children: /* @__PURE__ */ jsxRuntime.jsx(
1330
1336
  reactNative.Switch,
1331
1337
  {
1332
1338
  accessibilityHint: accessibilityHint ?? label,
@@ -1407,6 +1413,7 @@ var FormCheckbox = ({
1407
1413
  const brand = palette.primary["500"];
1408
1414
  const hintText = typeof hint === "string" && hint !== "" ? hint : description;
1409
1415
  const hasHint = typeof hintText === "string" && hintText !== "";
1416
+ const { hintId } = useFieldIds();
1410
1417
  const themeStyles = React2__default.default.useMemo(() => {
1411
1418
  const boxOn = { backgroundColor: brand, borderColor: brand };
1412
1419
  const boxOff = { backgroundColor: "transparent", borderColor: colors.border };
@@ -1435,6 +1442,7 @@ var FormCheckbox = ({
1435
1442
  accessibilityRole: "checkbox",
1436
1443
  accessibilityState: { checked: value, disabled },
1437
1444
  "aria-checked": value,
1445
+ "aria-describedby": hasHint ? hintId : void 0,
1438
1446
  disabled,
1439
1447
  onPress: toggle,
1440
1448
  role: "checkbox",
@@ -1450,7 +1458,7 @@ var FormCheckbox = ({
1450
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 }),
1451
1459
  /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: styles7.textColumn, children: [
1452
1460
  /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: [styles7.label, themeStyles.label], children: label }),
1453
- 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
1454
1462
  ] })
1455
1463
  ]
1456
1464
  }