react-native-a11y-order 0.9.1 → 0.11.0-alpha.0
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/README.md +35 -345
- package/android/src/main/java/com/a11yorder/A11yOrderPackage.java +2 -6
- package/android/src/main/java/com/a11yorder/core/A11yAutoFocusView.java +61 -0
- package/android/src/main/java/com/a11yorder/{views/A11yView/A11yView.java → core/A11yScreenReaderView.java} +3 -45
- package/android/src/main/java/com/a11yorder/core/A11yViewOrder.java +37 -0
- package/android/src/main/java/com/a11yorder/views/A11yCardView/A11yCardViewManager.java +18 -0
- package/android/src/main/java/com/a11yorder/views/A11yIndexView/A11yIndexView.java +2 -65
- package/android/src/main/java/com/a11yorder/views/A11yIndexView/A11yIndexViewManager.java +27 -0
- package/android/src/newarch/A11yCardViewManagerSpec.java +9 -0
- package/android/src/oldarch/A11yCardViewManagerSpec.java +8 -0
- package/android/src/oldarch/A11yIndexViewManagerSpec.java +9 -0
- package/ios/helpers/RNAOFabricEventHelper/RNAOFabricEventHelper.mm +5 -5
- package/ios/views/RNAOA11yCardView/RNAOA11yCardView.h +29 -0
- package/ios/views/RNAOA11yCardView/RNAOA11yCardView.mm +83 -0
- package/ios/views/RNAOA11yCardView/RNAOA11yCardViewManager.h +14 -0
- package/ios/views/RNAOA11yCardView/RNAOA11yCardViewManager.mm +17 -0
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.h +2 -41
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.mm +27 -127
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexViewManager.mm +21 -0
- package/ios/views/base/RNAOA11yAutoFocusView.h +30 -0
- package/ios/views/{RNAOA11yView/RNAOA11yView.mm → base/RNAOA11yAutoFocusView.mm} +66 -168
- package/ios/views/base/RNAOA11yGroupChildrenView.h +21 -0
- package/ios/views/base/RNAOA11yGroupChildrenView.mm +19 -0
- package/ios/views/base/RNAOA11yScreenReaderView.h +24 -0
- package/ios/views/base/RNAOA11yScreenReaderView.mm +32 -0
- package/ios/views/base/RNAOA11yViewGroup.h +35 -0
- package/ios/views/base/RNAOA11yViewGroup.mm +46 -0
- package/ios/views/base/RNAOA11yViewOrder.h +40 -0
- package/ios/views/base/RNAOA11yViewOrder.mm +92 -0
- package/lib/commonjs/components/A11yCard/A11yCard.ios.js +49 -0
- package/lib/commonjs/components/A11yCard/A11yCard.ios.js.map +1 -0
- package/lib/commonjs/components/A11yCard/A11yCard.js +41 -0
- package/lib/commonjs/components/A11yCard/A11yCard.js.map +1 -0
- package/lib/commonjs/{types/A11yGroup.types.js → components/A11yCard/A11yCard.types.js} +1 -1
- package/lib/commonjs/components/A11yCard/A11yCard.types.js.map +1 -0
- package/lib/commonjs/components/A11yIndex/A11yIndex.js +88 -28
- package/lib/commonjs/components/A11yIndex/A11yIndex.js.map +1 -1
- package/lib/commonjs/components/A11yIndex/A11yIndex.types.js +39 -0
- package/lib/commonjs/components/A11yIndex/A11yIndex.types.js.map +1 -0
- package/lib/commonjs/components/A11yIndex/A11yIndex.web.js.map +1 -1
- package/lib/commonjs/components/A11yLock/A11yFocusFrame/A11yFocusFrame.js.map +1 -1
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrap.js.map +1 -1
- package/lib/commonjs/components/A11yLock/A11yLock.types.js.map +1 -0
- package/lib/commonjs/components/{A11ySequence/A11ySequence.js → A11yOrder/A11yOrder.js} +3 -3
- package/lib/commonjs/components/A11yOrder/A11yOrder.js.map +1 -0
- package/lib/commonjs/{types/A11yModule.types.js → components/A11yOrder/A11yOrder.types.js} +1 -1
- package/lib/commonjs/components/A11yOrder/A11yOrder.types.js.map +1 -0
- package/lib/commonjs/components/A11yPaneTitle/A11yPaneTitle.js +6 -7
- package/lib/commonjs/components/A11yPaneTitle/A11yPaneTitle.js.map +1 -1
- package/lib/commonjs/components/A11yPaneTitle/A11yPaneTitle.types.js +6 -0
- package/lib/commonjs/components/A11yPaneTitle/A11yPaneTitle.types.js.map +1 -0
- package/lib/commonjs/components/A11yView/A11yView.js +7 -33
- package/lib/commonjs/components/A11yView/A11yView.js.map +1 -1
- package/lib/commonjs/components/A11yView/A11yView.types.js.map +1 -0
- package/lib/commonjs/index.js +17 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +10 -4
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/nativeSpecs/{A11yGroupNativeComponent.ts → A11yCardNativeComponent.ts} +3 -3
- package/lib/commonjs/nativeSpecs/A11yIndexNativeComponent.ts +12 -3
- package/lib/module/components/A11yCard/A11yCard.ios.js +43 -0
- package/lib/module/components/A11yCard/A11yCard.ios.js.map +1 -0
- package/lib/module/components/A11yCard/A11yCard.js +35 -0
- package/lib/module/components/A11yCard/A11yCard.js.map +1 -0
- package/lib/module/components/A11yCard/A11yCard.types.js +4 -0
- package/lib/module/components/A11yCard/A11yCard.types.js.map +1 -0
- package/lib/module/components/A11yIndex/A11yIndex.js +88 -28
- package/lib/module/components/A11yIndex/A11yIndex.js.map +1 -1
- package/lib/module/components/A11yIndex/A11yIndex.types.js +35 -0
- package/lib/module/components/A11yIndex/A11yIndex.types.js.map +1 -0
- package/lib/module/components/A11yIndex/A11yIndex.web.js.map +1 -1
- package/lib/module/components/A11yLock/A11yFocusFrame/A11yFocusFrame.js.map +1 -1
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrap.js.map +1 -1
- package/lib/module/components/A11yLock/A11yLock.types.js.map +1 -0
- package/lib/module/components/{A11ySequence/A11ySequence.js → A11yOrder/A11yOrder.js} +2 -2
- package/lib/module/components/A11yOrder/A11yOrder.js.map +1 -0
- package/lib/module/components/A11yOrder/A11yOrder.types.js +4 -0
- package/lib/module/components/A11yOrder/A11yOrder.types.js.map +1 -0
- package/lib/module/components/A11yPaneTitle/A11yPaneTitle.js +6 -7
- package/lib/module/components/A11yPaneTitle/A11yPaneTitle.js.map +1 -1
- package/lib/module/components/A11yPaneTitle/A11yPaneTitle.types.js +4 -0
- package/lib/module/components/A11yPaneTitle/A11yPaneTitle.types.js.map +1 -0
- package/lib/module/components/A11yView/A11yView.js +7 -31
- package/lib/module/components/A11yView/A11yView.js.map +1 -1
- package/lib/module/components/A11yView/A11yView.types.js.map +1 -0
- package/lib/module/index.js +12 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +4 -4
- package/lib/module/index.web.js.map +1 -1
- package/{src/nativeSpecs/A11yGroupNativeComponent.ts → lib/module/nativeSpecs/A11yCardNativeComponent.ts} +3 -3
- package/lib/module/nativeSpecs/A11yIndexNativeComponent.ts +12 -3
- package/lib/typescript/src/components/A11yCard/A11yCard.d.ts +5 -0
- package/lib/typescript/src/components/A11yCard/A11yCard.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yCard/A11yCard.ios.d.ts +5 -0
- package/lib/typescript/src/components/A11yCard/A11yCard.ios.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yCard/A11yCard.types.d.ts +14 -0
- package/lib/typescript/src/components/A11yCard/A11yCard.types.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yIndex/A11yIndex.d.ts +15 -10
- package/lib/typescript/src/components/A11yIndex/A11yIndex.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.types.d.ts +83 -0
- package/lib/typescript/src/components/A11yIndex/A11yIndex.types.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yIndex/A11yIndex.web.d.ts +14 -10
- package/lib/typescript/src/components/A11yIndex/A11yIndex.web.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yBaseLock/A11yBaseLock.d.ts +1 -1
- package/lib/typescript/src/components/A11yLock/A11yBaseLock/A11yBaseLock.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.d.ts +1 -1
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.d.ts +2 -2
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.d.ts +1 -1
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.d.ts +2 -2
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yLock.types.d.ts +31 -0
- package/lib/typescript/src/components/A11yLock/A11yLock.types.d.ts.map +1 -0
- package/lib/typescript/src/components/{A11ySequence/A11ySequence.d.ts → A11yOrder/A11yOrder.d.ts} +4 -2
- package/lib/typescript/src/components/A11yOrder/A11yOrder.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yOrder/A11yOrder.types.d.ts +11 -0
- package/lib/typescript/src/components/A11yOrder/A11yOrder.types.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yPaneTitle/A11yPaneTitle.d.ts +3 -17
- package/lib/typescript/src/components/A11yPaneTitle/A11yPaneTitle.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yPaneTitle/A11yPaneTitle.types.d.ts +43 -0
- package/lib/typescript/src/components/A11yPaneTitle/A11yPaneTitle.types.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yView/A11yView.d.ts +13 -6
- package/lib/typescript/src/components/A11yView/A11yView.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yView/A11yView.types.d.ts +10 -0
- package/lib/typescript/src/components/A11yView/A11yView.types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +32 -36
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +22 -22
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpecs/A11yCardNativeComponent.d.ts +8 -0
- package/lib/typescript/src/nativeSpecs/A11yCardNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/nativeSpecs/A11yIndexNativeComponent.d.ts +10 -3
- package/lib/typescript/src/nativeSpecs/A11yIndexNativeComponent.d.ts.map +1 -1
- package/package.json +12 -11
- package/src/components/A11yCard/A11yCard.ios.tsx +44 -0
- package/src/components/A11yCard/A11yCard.tsx +35 -0
- package/src/components/A11yCard/A11yCard.types.ts +39 -0
- package/src/components/A11yIndex/A11yIndex.tsx +144 -52
- package/src/components/A11yIndex/A11yIndex.types.ts +102 -0
- package/src/components/A11yIndex/A11yIndex.web.tsx +12 -17
- package/src/components/A11yLock/A11yBaseLock/A11yBaseLock.tsx +1 -1
- package/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.tsx +1 -1
- package/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.tsx +3 -2
- package/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.tsx +1 -1
- package/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.tsx +2 -2
- package/src/components/A11yLock/A11yLock.types.ts +34 -0
- package/src/components/{A11ySequence/A11ySequence.tsx → A11yOrder/A11yOrder.tsx} +4 -2
- package/src/components/A11yOrder/A11yOrder.types.ts +11 -0
- package/src/components/A11yPaneTitle/A11yPaneTitle.tsx +13 -19
- package/src/components/A11yPaneTitle/A11yPaneTitle.types.ts +49 -0
- package/src/components/A11yView/A11yView.tsx +8 -63
- package/src/components/A11yView/A11yView.types.ts +11 -0
- package/src/index.ts +26 -19
- package/src/index.web.ts +6 -13
- package/{lib/module/nativeSpecs/A11yGroupNativeComponent.ts → src/nativeSpecs/A11yCardNativeComponent.ts} +3 -3
- package/src/nativeSpecs/A11yIndexNativeComponent.ts +12 -3
- package/android/src/main/java/com/a11yorder/views/A11yGroupView/A11yGroupViewManager.java +0 -25
- package/android/src/main/java/com/a11yorder/views/A11yUIContainerView/A11yUIContainerViewManager.java +0 -30
- package/android/src/main/java/com/a11yorder/views/A11yView/A11yViewManager.java +0 -67
- package/android/src/newarch/A11yGroupViewManagerSpec.java +0 -9
- package/android/src/newarch/A11yUIContainerViewManagerSpec.java +0 -8
- package/android/src/newarch/A11yViewSpec.java +0 -13
- package/android/src/oldarch/A11yGroupViewManagerSpec.java +0 -8
- package/android/src/oldarch/A11yUIContainerViewManagerSpec.java +0 -9
- package/android/src/oldarch/A11yViewSpec.java +0 -18
- package/ios/views/RNAOA11yGroupView/RNAOA11yGroupView.h +0 -37
- package/ios/views/RNAOA11yGroupView/RNAOA11yGroupView.mm +0 -67
- package/ios/views/RNAOA11yGroupView/RNAOA11yGroupViewManager.h +0 -18
- package/ios/views/RNAOA11yGroupView/RNAOA11yGroupViewManager.mm +0 -25
- package/ios/views/RNAOA11yUIContainerView/RNAOA11yUIContainerView.h +0 -35
- package/ios/views/RNAOA11yUIContainerView/RNAOA11yUIContainerView.mm +0 -79
- package/ios/views/RNAOA11yUIContainerView/RNAOA11yUIContainerViewManager.h +0 -18
- package/ios/views/RNAOA11yUIContainerView/RNAOA11yUIContainerViewManager.mm +0 -27
- package/ios/views/RNAOA11yView/RNAOA11yView.h +0 -45
- package/ios/views/RNAOA11yView/RNAOA11yViewManager.h +0 -14
- package/ios/views/RNAOA11yView/RNAOA11yViewManager.mm +0 -53
- package/lib/commonjs/components/A11yGroup/A11yGroup.android.js +0 -18
- package/lib/commonjs/components/A11yGroup/A11yGroup.android.js.map +0 -1
- package/lib/commonjs/components/A11yGroup/A11yGroup.ios.js +0 -24
- package/lib/commonjs/components/A11yGroup/A11yGroup.ios.js.map +0 -1
- package/lib/commonjs/components/A11yGroup/A11yGroup.js +0 -9
- package/lib/commonjs/components/A11yGroup/A11yGroup.js.map +0 -1
- package/lib/commonjs/components/A11ySequence/A11ySequence.js.map +0 -1
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.ios.js +0 -22
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.ios.js.map +0 -1
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.js +0 -9
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.js.map +0 -1
- package/lib/commonjs/nativeSpecs/A11yUIContainerNativeComponent.ts +0 -12
- package/lib/commonjs/nativeSpecs/A11yViewNativeComponent.ts +0 -36
- package/lib/commonjs/types/A11yGroup.types.js.map +0 -1
- package/lib/commonjs/types/A11yIndex.types.js +0 -13
- package/lib/commonjs/types/A11yIndex.types.js.map +0 -1
- package/lib/commonjs/types/A11yLock.types.js.map +0 -1
- package/lib/commonjs/types/A11yModule.types.js.map +0 -1
- package/lib/commonjs/types/A11yUIContainerView.types.js +0 -15
- package/lib/commonjs/types/A11yUIContainerView.types.js.map +0 -1
- package/lib/commonjs/types/A11yView.types.js.map +0 -1
- package/lib/module/components/A11yGroup/A11yGroup.android.js +0 -12
- package/lib/module/components/A11yGroup/A11yGroup.android.js.map +0 -1
- package/lib/module/components/A11yGroup/A11yGroup.ios.js +0 -18
- package/lib/module/components/A11yGroup/A11yGroup.ios.js.map +0 -1
- package/lib/module/components/A11yGroup/A11yGroup.js +0 -5
- package/lib/module/components/A11yGroup/A11yGroup.js.map +0 -1
- package/lib/module/components/A11ySequence/A11ySequence.js.map +0 -1
- package/lib/module/components/A11yUIContainer/A11yUIContainer.ios.js +0 -17
- package/lib/module/components/A11yUIContainer/A11yUIContainer.ios.js.map +0 -1
- package/lib/module/components/A11yUIContainer/A11yUIContainer.js +0 -5
- package/lib/module/components/A11yUIContainer/A11yUIContainer.js.map +0 -1
- package/lib/module/nativeSpecs/A11yUIContainerNativeComponent.ts +0 -12
- package/lib/module/nativeSpecs/A11yViewNativeComponent.ts +0 -36
- package/lib/module/types/A11yGroup.types.js +0 -4
- package/lib/module/types/A11yGroup.types.js.map +0 -1
- package/lib/module/types/A11yIndex.types.js +0 -9
- package/lib/module/types/A11yIndex.types.js.map +0 -1
- package/lib/module/types/A11yLock.types.js.map +0 -1
- package/lib/module/types/A11yModule.types.js +0 -4
- package/lib/module/types/A11yModule.types.js.map +0 -1
- package/lib/module/types/A11yUIContainerView.types.js +0 -11
- package/lib/module/types/A11yUIContainerView.types.js.map +0 -1
- package/lib/module/types/A11yView.types.js.map +0 -1
- package/lib/typescript/src/components/A11yGroup/A11yGroup.android.d.ts +0 -4
- package/lib/typescript/src/components/A11yGroup/A11yGroup.android.d.ts.map +0 -1
- package/lib/typescript/src/components/A11yGroup/A11yGroup.d.ts +0 -3
- package/lib/typescript/src/components/A11yGroup/A11yGroup.d.ts.map +0 -1
- package/lib/typescript/src/components/A11yGroup/A11yGroup.ios.d.ts +0 -4
- package/lib/typescript/src/components/A11yGroup/A11yGroup.ios.d.ts.map +0 -1
- package/lib/typescript/src/components/A11ySequence/A11ySequence.d.ts.map +0 -1
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.d.ts +0 -3
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.d.ts.map +0 -1
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.ios.d.ts +0 -4
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.ios.d.ts.map +0 -1
- package/lib/typescript/src/nativeSpecs/A11yGroupNativeComponent.d.ts +0 -8
- package/lib/typescript/src/nativeSpecs/A11yGroupNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/nativeSpecs/A11yUIContainerNativeComponent.d.ts +0 -10
- package/lib/typescript/src/nativeSpecs/A11yUIContainerNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/nativeSpecs/A11yViewNativeComponent.d.ts +0 -26
- package/lib/typescript/src/nativeSpecs/A11yViewNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yGroup.types.d.ts +0 -7
- package/lib/typescript/src/types/A11yGroup.types.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yIndex.types.d.ts +0 -19
- package/lib/typescript/src/types/A11yIndex.types.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yLock.types.d.ts +0 -8
- package/lib/typescript/src/types/A11yLock.types.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yModule.types.d.ts +0 -7
- package/lib/typescript/src/types/A11yModule.types.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yUIContainerView.types.d.ts +0 -13
- package/lib/typescript/src/types/A11yUIContainerView.types.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yView.types.d.ts +0 -12
- package/lib/typescript/src/types/A11yView.types.d.ts.map +0 -1
- package/src/components/A11yGroup/A11yGroup.android.tsx +0 -8
- package/src/components/A11yGroup/A11yGroup.ios.tsx +0 -11
- package/src/components/A11yGroup/A11yGroup.tsx +0 -5
- package/src/components/A11yUIContainer/A11yUIContainer.ios.tsx +0 -20
- package/src/components/A11yUIContainer/A11yUIContainer.tsx +0 -5
- package/src/nativeSpecs/A11yUIContainerNativeComponent.ts +0 -12
- package/src/nativeSpecs/A11yViewNativeComponent.ts +0 -36
- package/src/types/A11yGroup.types.ts +0 -9
- package/src/types/A11yIndex.types.ts +0 -21
- package/src/types/A11yLock.types.ts +0 -8
- package/src/types/A11yModule.types.ts +0 -7
- package/src/types/A11yUIContainerView.types.ts +0 -15
- package/src/types/A11yView.types.ts +0 -19
- /package/lib/commonjs/{types → components/A11yLock}/A11yLock.types.js +0 -0
- /package/lib/commonjs/{types → components/A11yView}/A11yView.types.js +0 -0
- /package/lib/module/{types → components/A11yLock}/A11yLock.types.js +0 -0
- /package/lib/module/{types → components/A11yView}/A11yView.types.js +0 -0
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
export type { IndexCommands, A11yOrderType,
|
|
2
|
-
export
|
|
3
|
-
export type { ScreenReaderDescendantFocusChangedEvent } from './
|
|
4
|
-
export type { A11yViewProps } from './
|
|
1
|
+
export type { IndexCommands, A11yOrderType, A11yIndexProps, } from './components/A11yIndex/A11yIndex.types';
|
|
2
|
+
export { A11yOrderTypeEnum } from './components/A11yIndex/A11yIndex.types';
|
|
3
|
+
export type { ScreenReaderDescendantFocusChangedEvent } from './components/A11yView/A11yView.types';
|
|
4
|
+
export type { A11yViewProps } from './components/A11yView/A11yView.types';
|
|
5
5
|
export declare const A11y: {
|
|
6
6
|
Order: (props: Omit<import("react-native").ViewProps, keyof {
|
|
7
7
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
8
8
|
}> & {
|
|
9
9
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
10
10
|
}) => React.ReactNode;
|
|
11
|
-
|
|
12
|
-
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
13
|
-
}> & {
|
|
14
|
-
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
15
|
-
}) => React.ReactNode;
|
|
16
|
-
Index: import("react").NamedExoticComponent<{
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
index: number;
|
|
19
|
-
orderType?: import(".").A11yOrderType;
|
|
20
|
-
onScreenReaderSubViewFocusChange?: (isFocused: boolean) => void;
|
|
21
|
-
onScreenReaderSubViewFocused?: () => void;
|
|
22
|
-
onScreenReaderSubViewBlurred?: () => void;
|
|
23
|
-
} & Readonly<Omit<Readonly<{
|
|
11
|
+
Index: import("react").NamedExoticComponent<Readonly<Omit<Readonly<{
|
|
24
12
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => unknown) | undefined;
|
|
25
13
|
onAccessibilityTap?: (() => unknown) | undefined;
|
|
26
14
|
onLayout?: ((event: import("react-native").LayoutChangeEvent) => unknown) | undefined;
|
|
@@ -143,8 +131,20 @@ export declare const A11y: {
|
|
|
143
131
|
pointerEvents?: ("auto" | "box-none" | "box-only" | "none") | undefined;
|
|
144
132
|
removeClippedSubviews?: boolean | undefined;
|
|
145
133
|
experimental_accessibilityOrder?: Array<string> | undefined;
|
|
146
|
-
}>, never>> &
|
|
147
|
-
|
|
134
|
+
}>, never>> & {
|
|
135
|
+
children: React.ReactNode;
|
|
136
|
+
index?: number;
|
|
137
|
+
orderType?: import(".").A11yOrderType;
|
|
138
|
+
a11yUIContainer?: import("./components/A11yIndex/A11yIndex.types").A11yUIContainerType;
|
|
139
|
+
shouldGroupAccessibilityChildren?: boolean;
|
|
140
|
+
autoFocus?: boolean;
|
|
141
|
+
onScreenReaderFocused?: () => void;
|
|
142
|
+
onScreenReaderSubViewFocusChange?: (isFocused: boolean) => void;
|
|
143
|
+
onScreenReaderSubViewFocused?: () => void;
|
|
144
|
+
onScreenReaderSubViewBlurred?: () => void;
|
|
145
|
+
onScreenReaderDescendantFocusChanged?: (e: import(".").ScreenReaderDescendantFocusChangedEvent) => void;
|
|
146
|
+
} & import("react").RefAttributes<import(".").IndexCommands>>;
|
|
147
|
+
View: (props: Omit<import("react-native").ViewProps, keyof {
|
|
148
148
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
149
149
|
}> & {
|
|
150
150
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
@@ -159,17 +159,17 @@ export declare const A11y: {
|
|
|
159
159
|
}> & {
|
|
160
160
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
161
161
|
}) => React.ReactNode;
|
|
162
|
-
|
|
162
|
+
FocusFrame: (props: Omit<import("react-native").ViewProps, keyof {
|
|
163
163
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
164
164
|
}> & {
|
|
165
165
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
166
166
|
}) => React.ReactNode;
|
|
167
|
-
|
|
167
|
+
FocusTrap: (props: Omit<import("react-native").ViewProps, keyof {
|
|
168
168
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
169
169
|
}> & {
|
|
170
170
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
171
171
|
}) => React.ReactNode;
|
|
172
|
-
|
|
172
|
+
Card: (props: Omit<import("react-native").ViewProps, keyof {
|
|
173
173
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
174
174
|
}> & {
|
|
175
175
|
ref?: React.Ref<React.ComponentRef<typeof import("react-native").unstable_NativeView>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,aAAa,EACb,aAAa,EACb,
|
|
1
|
+
{"version":3,"file":"index.web.d.ts","sourceRoot":"","sources":["../../../src/index.web.ts"],"names":[],"mappings":"AAGA,YAAY,EACV,aAAa,EACb,aAAa,EACb,cAAc,GACf,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,YAAY,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AAEpG,YAAY,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E,eAAO,MAAM,IAAI;;WAYsH,CAAC;;WAAyE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAA3E,CAAC;;WAAyE,CAAC;;;WAA3E,CAAC;;WAAyE,CAAC;;;WAA3E,CAAC;;WAAyE,CAAC;;;WAA3E,CAAC;;WAAyE,CAAC;;;WAA3E,CAAC;;WAAyE,CAAC;;;WAA3E,CAAC;;WAAyE,CAAC;;CAHjN,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
export interface A11yCardNativeComponentProps extends ViewProps {
|
|
3
|
+
}
|
|
4
|
+
declare const _default: (props: Omit<A11yCardNativeComponentProps, "ref"> & {
|
|
5
|
+
ref?: React.Ref<import("react-native").HostInstance>;
|
|
6
|
+
}) => React.ReactNode;
|
|
7
|
+
export default _default;
|
|
8
|
+
//# sourceMappingURL=A11yCardNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"A11yCardNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpecs/A11yCardNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,WAAW,4BAA6B,SAAQ,SAAS;CAAG;;;;AAElE,wBAEE"}
|
|
@@ -6,12 +6,19 @@ export type ScreenReaderFocusChange = Readonly<{
|
|
|
6
6
|
}>;
|
|
7
7
|
export type ScreenReaderDescendantFocusChanged = Readonly<{
|
|
8
8
|
status: string;
|
|
9
|
+
nativeId?: string;
|
|
9
10
|
}>;
|
|
10
11
|
export interface A11yIndexNativeComponentProps extends ViewProps {
|
|
11
|
-
orderIndex
|
|
12
|
-
orderKey
|
|
13
|
-
orderFocusType
|
|
12
|
+
orderIndex?: Int32;
|
|
13
|
+
orderKey?: string;
|
|
14
|
+
orderFocusType?: Int32;
|
|
15
|
+
shouldGroupAccessibilityChildren?: Int32;
|
|
16
|
+
autoFocus?: boolean;
|
|
17
|
+
descendantFocusChangedEnabled?: boolean;
|
|
18
|
+
onScreenReaderFocused?: DirectEventHandler<{}>;
|
|
19
|
+
onScreenReaderDescendantFocusChanged?: DirectEventHandler<ScreenReaderDescendantFocusChanged>;
|
|
14
20
|
onScreenReaderFocusChange?: DirectEventHandler<ScreenReaderFocusChange>;
|
|
21
|
+
containerType?: Int32;
|
|
15
22
|
}
|
|
16
23
|
export interface NativeCommands {
|
|
17
24
|
focus: (viewRef: React.ElementRef<ComponentType>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"A11yIndexNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpecs/A11yIndexNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACN,MAAM,2CAA2C,CAAC;AAMnD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,QAAQ,CAAC;IACxD,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"A11yIndexNativeComponent.d.ts","sourceRoot":"","sources":["../../../../src/nativeSpecs/A11yIndexNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EACV,kBAAkB,EAClB,KAAK,EACN,MAAM,2CAA2C,CAAC;AAMnD,MAAM,MAAM,uBAAuB,GAAG,QAAQ,CAAC;IAC7C,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,QAAQ,CAAC;IACxD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,MAAM,WAAW,6BAA8B,SAAQ,SAAS;IAC9D,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,KAAK,CAAC;IACvB,gCAAgC,CAAC,EAAE,KAAK,CAAC;IAEzC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B,CAAC,EAAE,OAAO,CAAC;IAExC,qBAAqB,CAAC,EAAE,kBAAkB,CAAC,EAAE,CAAC,CAAC;IAC/C,oCAAoC,CAAC,EAAE,kBAAkB,CAAC,kCAAkC,CAAC,CAAC;IAC9F,yBAAyB,CAAC,EAAE,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;IAExE,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAE7B,KAAK,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CAC3D;AAED,eAAO,MAAM,QAAQ,EAAE,cAErB,CAAC;;;;AAEH,wBAEE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-a11y-order",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-alpha.0",
|
|
4
4
|
"description": "ReactNative library for managing screen reader focus ordering",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -25,10 +25,12 @@
|
|
|
25
25
|
"!**/__fixtures__",
|
|
26
26
|
"!**/__mocks__",
|
|
27
27
|
"!**/.*",
|
|
28
|
-
"!**/CLAUDE.md"
|
|
28
|
+
"!**/CLAUDE.md",
|
|
29
|
+
"!**/docs"
|
|
29
30
|
],
|
|
30
31
|
"scripts": {
|
|
31
32
|
"example": "yarn workspace a11y-order-example",
|
|
33
|
+
"example-legacy": "yarn workspace A11yOrderExample",
|
|
32
34
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
|
|
33
35
|
"prepare": "bob build",
|
|
34
36
|
"typecheck": "tsc",
|
|
@@ -64,11 +66,11 @@
|
|
|
64
66
|
"@eslint/compat": "^1.3.2",
|
|
65
67
|
"@eslint/eslintrc": "^3.3.1",
|
|
66
68
|
"@eslint/js": "^9.35.0",
|
|
67
|
-
"@react-native/babel-preset": "0.
|
|
68
|
-
"@react-native/eslint-config": "0.
|
|
69
|
+
"@react-native/babel-preset": "0.76.0",
|
|
70
|
+
"@react-native/eslint-config": "0.76.0",
|
|
69
71
|
"@release-it/conventional-changelog": "^10.0.1",
|
|
70
72
|
"@types/jest": "^29.5.14",
|
|
71
|
-
"@types/react": "^
|
|
73
|
+
"@types/react": "^18.2.0",
|
|
72
74
|
"commitlint": "^19.8.1",
|
|
73
75
|
"del-cli": "^6.0.0",
|
|
74
76
|
"eslint": "^9.35.0",
|
|
@@ -77,8 +79,8 @@
|
|
|
77
79
|
"jest": "^29.7.0",
|
|
78
80
|
"lefthook": "^2.0.3",
|
|
79
81
|
"prettier": "^2.8.8",
|
|
80
|
-
"react": "
|
|
81
|
-
"react-native": "0.
|
|
82
|
+
"react": "18.2.0",
|
|
83
|
+
"react-native": "0.76.0",
|
|
82
84
|
"react-native-builder-bob": "^0.40.18",
|
|
83
85
|
"release-it": "^19.0.4",
|
|
84
86
|
"turbo": "^2.5.6",
|
|
@@ -89,7 +91,8 @@
|
|
|
89
91
|
"react-native": "*"
|
|
90
92
|
},
|
|
91
93
|
"workspaces": [
|
|
92
|
-
"example"
|
|
94
|
+
"example",
|
|
95
|
+
"A11yOrderExample"
|
|
93
96
|
],
|
|
94
97
|
"packageManager": "yarn@4.11.0",
|
|
95
98
|
"react-native-builder-bob": {
|
|
@@ -112,12 +115,10 @@
|
|
|
112
115
|
"jsSrcsDir": "src",
|
|
113
116
|
"ios": {
|
|
114
117
|
"componentProvider": {
|
|
115
|
-
"
|
|
118
|
+
"A11yCardView": "RNAOA11yCardView",
|
|
116
119
|
"A11yIndexView": "RNAOA11yIndexView",
|
|
117
120
|
"A11yOrderView": "RNAOA11yOrderView",
|
|
118
|
-
"A11yUIContainer": "RNAOA11yUIContainerView",
|
|
119
121
|
"A11yPaneTitle": "RNAOA11yPaneTitleView",
|
|
120
|
-
"A11yView": "RNAOA11yView",
|
|
121
122
|
"A11yLock": "RNAOA11yLockView"
|
|
122
123
|
},
|
|
123
124
|
"modulesProvider": {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
|
+
import Card from '../../nativeSpecs/A11yCardNativeComponent';
|
|
4
|
+
import type { A11yCardProps } from './A11yCard.types';
|
|
5
|
+
|
|
6
|
+
export type { A11yCardProps };
|
|
7
|
+
|
|
8
|
+
export const A11yCard = ({
|
|
9
|
+
containerProps,
|
|
10
|
+
style,
|
|
11
|
+
testID,
|
|
12
|
+
onPress,
|
|
13
|
+
accessibility,
|
|
14
|
+
pressableProps,
|
|
15
|
+
children,
|
|
16
|
+
}: A11yCardProps) => {
|
|
17
|
+
return (
|
|
18
|
+
<Card {...containerProps} style={[styles.container, containerProps?.style]}>
|
|
19
|
+
<View
|
|
20
|
+
testID={`${testID}-overlay`}
|
|
21
|
+
accessibilityRole="button"
|
|
22
|
+
{...accessibility}
|
|
23
|
+
accessible
|
|
24
|
+
pointerEvents="none"
|
|
25
|
+
onAccessibilityTap={onPress}
|
|
26
|
+
style={styles.overlay}
|
|
27
|
+
/>
|
|
28
|
+
<Pressable
|
|
29
|
+
{...pressableProps}
|
|
30
|
+
accessible={false}
|
|
31
|
+
onPress={onPress}
|
|
32
|
+
testID={testID}
|
|
33
|
+
style={style}
|
|
34
|
+
>
|
|
35
|
+
{children}
|
|
36
|
+
</Pressable>
|
|
37
|
+
</Card>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const styles = StyleSheet.create({
|
|
42
|
+
container: { position: 'relative' },
|
|
43
|
+
overlay: StyleSheet.absoluteFillObject,
|
|
44
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
|
+
import type { A11yCardProps } from './A11yCard.types';
|
|
4
|
+
|
|
5
|
+
export type { A11yCardProps };
|
|
6
|
+
|
|
7
|
+
export const A11yCard = ({
|
|
8
|
+
containerProps,
|
|
9
|
+
style,
|
|
10
|
+
testID,
|
|
11
|
+
onPress,
|
|
12
|
+
accessibility,
|
|
13
|
+
pressableProps,
|
|
14
|
+
children,
|
|
15
|
+
}: A11yCardProps) => {
|
|
16
|
+
return (
|
|
17
|
+
<View collapsable={false} {...containerProps}>
|
|
18
|
+
<Pressable
|
|
19
|
+
{...pressableProps}
|
|
20
|
+
accessibilityRole="button"
|
|
21
|
+
{...accessibility}
|
|
22
|
+
accessible
|
|
23
|
+
onPress={onPress}
|
|
24
|
+
testID={testID}
|
|
25
|
+
style={[style, styles.container]}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</Pressable>
|
|
29
|
+
</View>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const styles = StyleSheet.create({
|
|
34
|
+
container: { position: 'relative' },
|
|
35
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ViewStyle,
|
|
3
|
+
StyleProp,
|
|
4
|
+
ViewProps,
|
|
5
|
+
PressableProps,
|
|
6
|
+
} from 'react-native';
|
|
7
|
+
|
|
8
|
+
// All screen-reader-facing props, typed directly from ViewProps so they
|
|
9
|
+
// stay in sync with RN without a separate custom interface.
|
|
10
|
+
export type A11yCardAccessibilityProps = ViewProps;
|
|
11
|
+
|
|
12
|
+
export interface A11yCardProps {
|
|
13
|
+
// Props for the outer container (<Card> on iOS, <View> on Android).
|
|
14
|
+
// Use for margins, flex, and layout positioning in the parent.
|
|
15
|
+
containerProps?: ViewProps;
|
|
16
|
+
|
|
17
|
+
// Visual style of the inner Pressable (background, border, shadow, etc.).
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
testID?: string;
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
onPress?: () => void;
|
|
22
|
+
// Note: onLongPress fires for sighted users. For VoiceOver users add a
|
|
23
|
+
// custom action via accessibility.accessibilityActions — VoiceOver activates
|
|
24
|
+
// via double-tap (onPress), not long-press.
|
|
25
|
+
onLongPress?: () => void;
|
|
26
|
+
|
|
27
|
+
// What the screen reader announces and interacts with.
|
|
28
|
+
// On iOS applied to the overlay (first in accessibilityElements).
|
|
29
|
+
// On Android applied to the Pressable directly.
|
|
30
|
+
// disabled auto-merges into accessibility.accessibilityState.disabled so
|
|
31
|
+
// you only need to set disabled once.
|
|
32
|
+
accessibility?: A11yCardAccessibilityProps;
|
|
33
|
+
|
|
34
|
+
// Escape hatch for Pressable props not covered above (hitSlop, android_ripple, etc.).
|
|
35
|
+
// Conflicting keys are stripped to prevent accidental overrides.
|
|
36
|
+
pressableProps?: PressableProps;
|
|
37
|
+
|
|
38
|
+
children?: React.ReactNode;
|
|
39
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
2
3
|
import { A11ySequenceOrderContext } from '../../context/A11ySequenceOrderContext';
|
|
3
4
|
import A11yIndexView, {
|
|
4
5
|
Commands,
|
|
@@ -6,8 +7,113 @@ import A11yIndexView, {
|
|
|
6
7
|
import {
|
|
7
8
|
type A11yIndexProps,
|
|
8
9
|
A11yOrderTypeEnum,
|
|
10
|
+
type A11yOrderType,
|
|
9
11
|
type IndexCommands,
|
|
10
|
-
|
|
12
|
+
A11yContainerTypeEnum,
|
|
13
|
+
} from './A11yIndex.types';
|
|
14
|
+
|
|
15
|
+
type ScreenReaderCallbacks = Pick<
|
|
16
|
+
A11yIndexProps,
|
|
17
|
+
| 'onScreenReaderFocused'
|
|
18
|
+
| 'onScreenReaderSubViewFocusChange'
|
|
19
|
+
| 'onScreenReaderSubViewFocused'
|
|
20
|
+
| 'onScreenReaderSubViewBlurred'
|
|
21
|
+
| 'onScreenReaderDescendantFocusChanged'
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
function useScreenReaderProps({
|
|
25
|
+
onScreenReaderFocused,
|
|
26
|
+
onScreenReaderSubViewFocusChange,
|
|
27
|
+
onScreenReaderSubViewFocused,
|
|
28
|
+
onScreenReaderSubViewBlurred,
|
|
29
|
+
onScreenReaderDescendantFocusChanged,
|
|
30
|
+
}: ScreenReaderCallbacks) {
|
|
31
|
+
const hasHandler = Boolean(
|
|
32
|
+
onScreenReaderSubViewBlurred ||
|
|
33
|
+
onScreenReaderSubViewFocused ||
|
|
34
|
+
onScreenReaderSubViewFocusChange
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const onScreenReaderFocusChange = React.useCallback(
|
|
38
|
+
(event: { nativeEvent: { isFocused: boolean } }) => {
|
|
39
|
+
const { isFocused } = event.nativeEvent;
|
|
40
|
+
onScreenReaderSubViewFocusChange?.(isFocused);
|
|
41
|
+
if (isFocused) {
|
|
42
|
+
onScreenReaderSubViewFocused?.();
|
|
43
|
+
} else {
|
|
44
|
+
onScreenReaderSubViewBlurred?.();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
[
|
|
48
|
+
onScreenReaderSubViewFocusChange,
|
|
49
|
+
onScreenReaderSubViewBlurred,
|
|
50
|
+
onScreenReaderSubViewFocused,
|
|
51
|
+
]
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
onScreenReaderFocused,
|
|
56
|
+
onScreenReaderFocusChange: hasHandler
|
|
57
|
+
? onScreenReaderFocusChange
|
|
58
|
+
: undefined,
|
|
59
|
+
descendantFocusChangedEnabled: Boolean(
|
|
60
|
+
onScreenReaderDescendantFocusChanged
|
|
61
|
+
),
|
|
62
|
+
onScreenReaderDescendantFocusChanged,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function useFocusRef(ref: React.ForwardedRef<IndexCommands>) {
|
|
67
|
+
const localRef = useRef<React.ComponentRef<typeof A11yIndexView>>(null);
|
|
68
|
+
|
|
69
|
+
useImperativeHandle(ref, () => {
|
|
70
|
+
const native = localRef.current as unknown as Record<string, unknown>;
|
|
71
|
+
|
|
72
|
+
return new Proxy({} as IndexCommands, {
|
|
73
|
+
get(_target, prop: string) {
|
|
74
|
+
if (prop === 'focus') {
|
|
75
|
+
return () => {
|
|
76
|
+
if (localRef.current) {
|
|
77
|
+
// @ts-expect-error Commands.focus type is too generic in codegen
|
|
78
|
+
Commands.focus(localRef.current);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return native?.[prop];
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return localRef;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function useOrderProps(
|
|
91
|
+
index: number | undefined,
|
|
92
|
+
orderType: A11yOrderType | undefined,
|
|
93
|
+
importantForAccessibilityProp: ViewProps['importantForAccessibility']
|
|
94
|
+
) {
|
|
95
|
+
const orderKey = React.useContext(A11ySequenceOrderContext);
|
|
96
|
+
const hasOrderInfo = typeof index === 'number' || !!orderKey;
|
|
97
|
+
|
|
98
|
+
if (hasOrderInfo && !orderKey) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
'<A11y.Index> element should be used inside of <A11y.Order> container'
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const resolvedOrderType = orderType ?? 'default';
|
|
105
|
+
const importantForAccessibilityFallback =
|
|
106
|
+
resolvedOrderType === 'default' ? ('yes' as const) : undefined;
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
orderKey,
|
|
110
|
+
orderFocusType: hasOrderInfo
|
|
111
|
+
? A11yOrderTypeEnum[resolvedOrderType]
|
|
112
|
+
: undefined,
|
|
113
|
+
importantForAccessibility:
|
|
114
|
+
importantForAccessibilityProp ?? importantForAccessibilityFallback,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
11
117
|
|
|
12
118
|
export const A11yIndex = React.memo(
|
|
13
119
|
React.forwardRef<IndexCommands, A11yIndexProps>(
|
|
@@ -15,72 +121,58 @@ export const A11yIndex = React.memo(
|
|
|
15
121
|
{
|
|
16
122
|
children,
|
|
17
123
|
index,
|
|
18
|
-
orderType
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
onScreenReaderSubViewBlurred,
|
|
124
|
+
orderType,
|
|
125
|
+
a11yUIContainer,
|
|
126
|
+
shouldGroupAccessibilityChildren,
|
|
22
127
|
...props
|
|
23
128
|
},
|
|
24
129
|
ref
|
|
25
130
|
) => {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (event.nativeEvent.isFocused) {
|
|
36
|
-
onScreenReaderSubViewFocused?.();
|
|
37
|
-
} else {
|
|
38
|
-
onScreenReaderSubViewBlurred?.();
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
[
|
|
42
|
-
onScreenReaderSubViewFocusChange,
|
|
43
|
-
onScreenReaderSubViewBlurred,
|
|
44
|
-
onScreenReaderSubViewFocused,
|
|
45
|
-
]
|
|
46
|
-
);
|
|
131
|
+
const {
|
|
132
|
+
onScreenReaderFocused,
|
|
133
|
+
onScreenReaderSubViewFocusChange,
|
|
134
|
+
onScreenReaderSubViewFocused,
|
|
135
|
+
onScreenReaderSubViewBlurred,
|
|
136
|
+
onScreenReaderDescendantFocusChanged,
|
|
137
|
+
importantForAccessibility: importantForAccessibilityProp,
|
|
138
|
+
...viewProps
|
|
139
|
+
} = props;
|
|
47
140
|
|
|
48
|
-
const
|
|
49
|
-
?
|
|
141
|
+
const containerTypeValue = a11yUIContainer
|
|
142
|
+
? A11yContainerTypeEnum[a11yUIContainer]
|
|
50
143
|
: undefined;
|
|
51
144
|
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
145
|
+
const shouldGroupChildrenValue =
|
|
146
|
+
shouldGroupAccessibilityChildren === undefined
|
|
147
|
+
? -1
|
|
148
|
+
: shouldGroupAccessibilityChildren
|
|
149
|
+
? 1
|
|
150
|
+
: 0;
|
|
58
151
|
|
|
59
|
-
|
|
60
|
-
|
|
152
|
+
const screenReaderNativeProps = useScreenReaderProps({
|
|
153
|
+
onScreenReaderFocused,
|
|
154
|
+
onScreenReaderSubViewFocusChange,
|
|
155
|
+
onScreenReaderSubViewFocused,
|
|
156
|
+
onScreenReaderSubViewBlurred,
|
|
157
|
+
onScreenReaderDescendantFocusChanged,
|
|
158
|
+
});
|
|
61
159
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (indexRef.current) {
|
|
65
|
-
Commands.focus(indexRef.current);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
}));
|
|
160
|
+
const { orderKey, orderFocusType, importantForAccessibility } =
|
|
161
|
+
useOrderProps(index, orderType, importantForAccessibilityProp);
|
|
69
162
|
|
|
70
|
-
const
|
|
71
|
-
orderType === 'default' ? 'yes' : undefined;
|
|
163
|
+
const localRef = useFocusRef(ref);
|
|
72
164
|
|
|
73
165
|
return (
|
|
74
166
|
<A11yIndexView
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
167
|
+
ref={localRef as React.Ref<any>}
|
|
168
|
+
{...viewProps}
|
|
169
|
+
containerType={containerTypeValue}
|
|
170
|
+
shouldGroupAccessibilityChildren={shouldGroupChildrenValue}
|
|
171
|
+
importantForAccessibility={importantForAccessibility}
|
|
172
|
+
orderFocusType={orderFocusType}
|
|
80
173
|
orderIndex={index}
|
|
81
174
|
orderKey={orderKey}
|
|
82
|
-
{...
|
|
83
|
-
onScreenReaderFocusChange={onScreenReaderHandlerProp}
|
|
175
|
+
{...screenReaderNativeProps}
|
|
84
176
|
>
|
|
85
177
|
{children}
|
|
86
178
|
</A11yIndexView>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { NativeSyntheticEvent, View, ViewProps } from 'react-native';
|
|
3
|
+
import type { ScreenReaderDescendantFocusChanged } from '../../nativeSpecs/A11yIndexNativeComponent';
|
|
4
|
+
|
|
5
|
+
/** Ref handle for {@link A11y.Index} — exposes `focus()` to move screen reader focus programmatically. */
|
|
6
|
+
export type IndexCommands = Omit<React.ComponentRef<typeof View>, 'focus'> & {
|
|
7
|
+
/** Moves screen reader focus to this element. */
|
|
8
|
+
focus: () => void;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Numeric backing values for {@link A11yOrderType}. Kept for consumers who need the raw number. */
|
|
12
|
+
export const A11yOrderTypeEnum = {
|
|
13
|
+
default: 0,
|
|
14
|
+
child: 1,
|
|
15
|
+
subview: 2,
|
|
16
|
+
} as const;
|
|
17
|
+
|
|
18
|
+
/** @internal Numeric backing values for {@link A11yUIContainerType}. */
|
|
19
|
+
export const A11yContainerTypeEnum = {
|
|
20
|
+
none: 0,
|
|
21
|
+
table: 1,
|
|
22
|
+
list: 2,
|
|
23
|
+
landmark: 3,
|
|
24
|
+
group: 4,
|
|
25
|
+
} as const;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* iOS only — sets `UIAccessibilityContainerType` on the wrapping view.
|
|
29
|
+
* Tells VoiceOver what kind of container this is: `'list'`, `'table'`, `'landmark'`, etc.
|
|
30
|
+
*/
|
|
31
|
+
export type A11yUIContainerType = keyof typeof A11yContainerTypeEnum;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Controls which element receives screen reader focus for this index slot.
|
|
35
|
+
*
|
|
36
|
+
* - `'default'` — the `A11y.Index` view itself
|
|
37
|
+
* - `'child'` — the first accessible child (useful when the index wrapper has no visual presence)
|
|
38
|
+
* - `'subview'` — first accessible child via an older traversal path
|
|
39
|
+
*/
|
|
40
|
+
export type A11yOrderType = keyof typeof A11yOrderTypeEnum;
|
|
41
|
+
|
|
42
|
+
/** The native event payload emitted by `onScreenReaderDescendantFocusChanged`. */
|
|
43
|
+
export type ScreenReaderDescendantFocusChangedEvent =
|
|
44
|
+
NativeSyntheticEvent<ScreenReaderDescendantFocusChanged>;
|
|
45
|
+
|
|
46
|
+
export type A11yIndexProps = ViewProps & {
|
|
47
|
+
children: React.ReactNode;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Numeric position of this element in the parent `A11y.Order` sequence.
|
|
51
|
+
* Lower numbers are focused first; ties are resolved by render order.
|
|
52
|
+
*/
|
|
53
|
+
index?: number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Controls which element VoiceOver / TalkBack actually focuses.
|
|
57
|
+
* Defaults to `'default'` (the index view itself).
|
|
58
|
+
*/
|
|
59
|
+
orderType?: A11yOrderType;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* iOS only — sets `UIAccessibilityContainerType`.
|
|
63
|
+
* Helps VoiceOver understand the semantic container type (list, table, landmark…).
|
|
64
|
+
*/
|
|
65
|
+
a11yUIContainer?: A11yUIContainerType;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* iOS only — controls the wrapping view's `shouldGroupAccessibilityChildren`.
|
|
69
|
+
* Determines whether VoiceOver treats descendants as one grouped unit
|
|
70
|
+
* or navigates them individually.
|
|
71
|
+
*
|
|
72
|
+
* - `true` — group descendants; VoiceOver focuses the wrapper as a single
|
|
73
|
+
* element with a combined label built from its children.
|
|
74
|
+
* - `false` — force descendants to remain individually focusable even when
|
|
75
|
+
* iOS would otherwise group them.
|
|
76
|
+
* - omitted — defer to the wrapping view's default behavior.
|
|
77
|
+
*/
|
|
78
|
+
shouldGroupAccessibilityChildren?: boolean;
|
|
79
|
+
|
|
80
|
+
/** When `true`, requests screen reader focus on this element immediately after mount. */
|
|
81
|
+
autoFocus?: boolean;
|
|
82
|
+
|
|
83
|
+
/** Called when the screen reader focuses this element directly. */
|
|
84
|
+
onScreenReaderFocused?: () => void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Called whenever screen reader focus enters or leaves any descendant.
|
|
88
|
+
* `isFocused` is `true` on enter, `false` on leave.
|
|
89
|
+
*/
|
|
90
|
+
onScreenReaderSubViewFocusChange?: (isFocused: boolean) => void;
|
|
91
|
+
|
|
92
|
+
/** Called when screen reader focus enters any descendant. */
|
|
93
|
+
onScreenReaderSubViewFocused?: () => void;
|
|
94
|
+
|
|
95
|
+
/** Called when screen reader focus leaves any descendant. */
|
|
96
|
+
onScreenReaderSubViewBlurred?: () => void;
|
|
97
|
+
|
|
98
|
+
/** Called with the native event when screen reader focus changes on any descendant. */
|
|
99
|
+
onScreenReaderDescendantFocusChanged?: (
|
|
100
|
+
e: ScreenReaderDescendantFocusChangedEvent
|
|
101
|
+
) => void;
|
|
102
|
+
};
|