You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'@noriginmedia/norigin-spatial-navigation-core': minor
3
+
'@noriginmedia/norigin-spatial-navigation-react': minor
4
+
'@noriginmedia/norigin-spatial-navigation': minor
5
+
---
6
+
7
+
Add accessibility labels on focusable components.
8
+
9
+
Introduces a new optional `onUtterText` callback on `init()` and an `accessibilityLabel` prop on `useFocusable()` (and the underlying `addFocusable` / `updateFocusable` payloads). When focus lands on a focusable component, the library concatenates the labels of all newly-entered parent regions with the leaf node's own label and passes the resulting string to `onUtterText`. Parent region labels are only included when focus enters a region for the first time (similar to how `aria-label` on `role="region"` behaves), so subsequent focus moves within the same parent only utter the leaf label.
10
+
11
+
This library does not implement Text-To-Speech itself — it only provides a unified way to declare accessibility labels and wire the callback to the platform's TTS engine, which is particularly useful for cross-platform TV apps where native `aria-*` support is fragmented.
|`debug`|`boolean`|`false`| Log navigation decisions to the browser console. |
64
-
|`visualDebug`|`boolean`|`false`| Draw a canvas overlay showing component bounding boxes and navigation paths. |
65
-
|`nativeMode`|`boolean`|`false`|**Deprecated.** Disable DOM key event listeners (for React Native). You must drive navigation manually. |
66
-
|`throttle`|`number`|`0`| Milliseconds to wait between processing repeated key presses. `0` means no throttle. |
67
-
|`throttleKeypresses`|`boolean`|`false`| When `true` and `throttle > 0`, throttle key repeat events while a key is held down. |
68
-
|`useGetBoundingClientRect`|`boolean`|`false`| Use `getBoundingClientRect()` instead of `offsetLeft/Top` for layout measurement. Use this when elements are CSS-transformed or scaled. |
69
-
|`shouldFocusDOMNode`|`boolean`|`false`| Call `HTMLElement.focus()` on the focused component's DOM node, enabling native browser focus behavior and accessibility. |
70
-
|`domNodeFocusOptions`|`FocusOptions`|`undefined`| Options passed to `HTMLElement.focus()` when `shouldFocusDOMNode` is `true`. |
71
-
|`shouldUseNativeEvents`|`boolean`|`false`| Do not call `preventDefault()` on key events, allowing the browser to handle them natively as well. |
72
-
|`rtl`|`boolean`|`false`| Enable right-to-left layout mode. Left and right navigation directions are swapped. |
73
-
|`distanceCalculationMethod`|`'center' \| 'edges' \| 'corners'`|`'corners'`| Algorithm used to calculate distance between components. See [Distance Calculation](../guides/distance-calculation.md). |
74
-
|`customDistanceCalculationFunction`|`function`|`undefined`| Override the secondary-axis distance calculation. See [Distance Calculation](../guides/distance-calculation.md). |
|`debug`|`boolean`|`false`| Log navigation decisions to the browser console. |
65
+
|`visualDebug`|`boolean`|`false`| Draw a canvas overlay showing component bounding boxes and navigation paths. |
66
+
|`nativeMode`|`boolean`|`false`|**Deprecated.** Disable DOM key event listeners (for React Native). You must drive navigation manually. |
67
+
|`throttle`|`number`|`0`| Milliseconds to wait between processing repeated key presses. `0` means no throttle. |
68
+
|`throttleKeypresses`|`boolean`|`false`| When `true` and `throttle > 0`, throttle key repeat events while a key is held down. |
69
+
|`useGetBoundingClientRect`|`boolean`|`false`| Use `getBoundingClientRect()` instead of `offsetLeft/Top` for layout measurement. Use this when elements are CSS-transformed or scaled. |
70
+
|`shouldFocusDOMNode`|`boolean`|`false`| Call `HTMLElement.focus()` on the focused component's DOM node, enabling native browser focus behavior and accessibility. |
71
+
|`domNodeFocusOptions`|`FocusOptions`|`undefined`| Options passed to `HTMLElement.focus()` when `shouldFocusDOMNode` is `true`. |
72
+
|`shouldUseNativeEvents`|`boolean`|`false`| Do not call `preventDefault()` on key events, allowing the browser to handle them natively as well. |
73
+
|`rtl`|`boolean`|`false`| Enable right-to-left layout mode. Left and right navigation directions are swapped. |
74
+
|`distanceCalculationMethod`|`'center' \| 'edges' \| 'corners'`|`'corners'`| Algorithm used to calculate distance between components. See [Distance Calculation](../guides/distance-calculation.md). |
75
+
|`customDistanceCalculationFunction`|`function`|`undefined`| Override the secondary-axis distance calculation. See [Distance Calculation](../guides/distance-calculation.md). |
76
+
|`onUtterText`|`(text: string) => void`|`undefined`| Global callback invoked with a concatenated accessibility label string whenever focus changes. Wire this to your platform's Text-To-Speech engine. See the [Accessibility Labels](../guides/accessibility-labels.md) guide. |
75
77
76
78
### Example
77
79
@@ -83,7 +85,11 @@ init({
83
85
visualDebug: false,
84
86
distanceCalculationMethod: 'center',
85
87
throttle: 150,
86
-
throttleKeypresses: true
88
+
throttleKeypresses: true,
89
+
onUtterText: (text) => {
90
+
// Hand the string off to the platform's Text-To-Speech engine
0 commit comments