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
package/README.md
CHANGED
|
@@ -1,371 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
React Native A11y Order Library: Enhance screen reader functionality with advanced control.
|
|
1
|
+
[](https://www.linkedin.com/in/artur-kalach-99477b138/recent-activity/articles/)
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
# React Native A11y Order
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
<div>
|
|
6
|
+
<img align="right" width="35%" src="/.github/images/ios_example.gif">
|
|
7
|
+
</div>
|
|
10
8
|
|
|
9
|
+
Native-first React Native library for controlling screen reader focus order on iOS (VoiceOver) and Android (TalkBack).
|
|
11
10
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
11
|
+
- 🔢 **Custom focus order** — define the exact sequence, independent of render order
|
|
12
|
+
- 🃏 **Cards with inner buttons** — card action and nested controls, both accessible at once
|
|
13
|
+
- 🔒 **Focus trap** — keep VoiceOver and TalkBack inside modals, no leaking
|
|
14
|
+
- 📣 **Transition announcements** — notify the screen reader on screen and panel changes
|
|
15
|
+
- ⚡ New Architecture · Old Architecture · Bridgeless · Expo prebuild
|
|
17
16
|
|
|
18
17
|
> [!TIP]
|
|
19
|
-
>
|
|
20
|
-
> By default, React Native optimizes views, which can sometimes impact the focus order unintentionally.
|
|
21
|
-
>
|
|
22
|
-
> While this library is designed to handle complex or unusual focus scenarios, in many cases, using `<View collapsable={false}>` can resolve focus issues without requiring additional work.
|
|
18
|
+
> Before adding this library, try `<View collapsable={false}>` — it fixes most simple focus order issues with no extra dependencies. [Learn more](./docs/guides/collapsable.md)
|
|
23
19
|
|
|
24
20
|
> [!IMPORTANT]
|
|
25
|
-
>
|
|
26
|
-
> You can find more information in the [Accessibility documentation](https://reactnative.dev/docs/accessibility).
|
|
21
|
+
> React Native v0.8.2+ includes an experimental `experimental_accessibilityOrder` prop — see [Accessibility docs](https://reactnative.dev/docs/accessibility).
|
|
27
22
|
|
|
23
|
+
</br>
|
|
28
24
|
|
|
29
25
|
## Installation
|
|
30
26
|
|
|
31
|
-
```sh
|
|
32
|
-
npm install react-native-a11y-order
|
|
33
|
-
```
|
|
34
|
-
|
|
35
27
|
```sh
|
|
36
28
|
yarn add react-native-a11y-order
|
|
29
|
+
cd ios && pod install
|
|
37
30
|
```
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
#### A11y.Order, A11y.Index
|
|
42
|
-
|
|
43
|
-
To set the focus order for a screen reader in React Native, you can use the following components:
|
|
44
|
-
- `A11y.Order`: A container component that creates an ordering group for focusable elements.
|
|
45
|
-
- `A11y.Index`: A wrapper component that defines the position of an element within the ordering group.
|
|
46
|
-
|
|
47
|
-
Using these components together simplifies the process of managing focus order in complex UI structures.
|
|
48
|
-
|
|
49
|
-
To illustrate, let's look at an example:
|
|
50
|
-
|
|
51
|
-
```js
|
|
52
|
-
import { A11y } from 'react-native-a11y-order';
|
|
53
|
-
|
|
54
|
-
// ...
|
|
55
|
-
|
|
56
|
-
export default function App() {
|
|
57
|
-
return (
|
|
58
|
-
<View style={styles.container}>
|
|
59
|
-
<A11y.Order>
|
|
60
|
-
<A11y.Index index={1}>
|
|
61
|
-
<Text style={styles.font}>
|
|
62
|
-
First
|
|
63
|
-
</Text>
|
|
64
|
-
</A11y.Index>
|
|
65
|
-
<A11y.Index index={3}>
|
|
66
|
-
<Text style={styles.font}>
|
|
67
|
-
Third
|
|
68
|
-
</Text>
|
|
69
|
-
</A11y.Index>
|
|
70
|
-
<A11y.Index index={2}>
|
|
71
|
-
<Text style={styles.font}>
|
|
72
|
-
Second
|
|
73
|
-
</Text>
|
|
74
|
-
</A11y.Index>
|
|
75
|
-
</A11y.Order>
|
|
76
|
-
<Text style={styles.font}>Fourth</Text>
|
|
77
|
-
<Text style={styles.font}>Fifth</Text>
|
|
78
|
-
<Text style={styles.font}>Sixth</Text>
|
|
79
|
-
</View>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Additionally, for dynamic interaction scenarios, programmatically setting focus can be highly effective. You can achieve this by using the focus method through a component reference.
|
|
85
|
-
|
|
86
|
-
```js
|
|
87
|
-
import { A11y, IndexCommands } from 'react-native-a11y-order';
|
|
88
|
-
|
|
89
|
-
// ...
|
|
90
|
-
|
|
91
|
-
export default function App() {
|
|
92
|
-
const ref = React.useRef<IndexCommands>(null);
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<View style={styles.container}>
|
|
96
|
-
<A11y.Order>
|
|
97
|
-
<A11y.Index ref={ref} index={1}>
|
|
98
|
-
<Text style={styles.font}>
|
|
99
|
-
First
|
|
100
|
-
</Text>
|
|
101
|
-
</A11y.Index>
|
|
102
|
-
</A11y.Order>
|
|
103
|
-
<Button onPress={() => ref.current?.focus()}>
|
|
104
|
-
</View>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
A11y.Index Props:
|
|
109
|
-
| Prop | Description |
|
|
110
|
-
| :-- | :-- |
|
|
111
|
-
| ViewProps | Standard React Native View properties, including style, testID, etc. |
|
|
112
|
-
| index | (number) The position of the component in the order sequence. |
|
|
113
|
-
| ref: focus | Reference to a focus command, used to set accessibility focus programmatically. |
|
|
114
|
-
| orderType | Specifies the algorithm used for view ordering (see details below). |
|
|
115
|
-
| onScreenReaderSubViewFocused | Triggered when a subview within the component is focused by the screen reader. |
|
|
116
|
-
| onScreenReaderSubViewBlurred | Triggered when the screen reader focus moves away or is blurred from a subview. |
|
|
117
|
-
| onScreenReaderSubViewFocusChange | Triggered when the focus status of a subview changes (either focused or blurred). |
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
| Value | Description |
|
|
121
|
-
| :-- | :-- |
|
|
122
|
-
| default | Treats the root component as an orderable element. This can be a group or a single element. If multiple elements are present, navigation moves through the inner elements before proceeding to the next index. |
|
|
123
|
-
| legacy | Uses the previous implementation for element search, selecting the first child as the accessibility element for ordering. |
|
|
124
|
-
| search | Searches the child tree for the first accessible element to use in the order. |
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
A11y.Order Props:
|
|
128
|
-
|
|
129
|
-
| Prop | Description |
|
|
130
|
-
| :-- | :-- |
|
|
131
|
-
| ...ViewProps | Standard React Native View props, including style, testID, etc. |
|
|
132
|
-
|
|
133
|
-
## A11y.Container
|
|
134
|
-
| View | A11y.Container |
|
|
135
|
-
| --------------------------------------------------------- | ------------------------------------------------------------- |
|
|
136
|
-
| <img src="/.github/images/horizontal-scroll-view.gif" height="500" /> | <img src="/.github/images/horizontal-scroll-group.gif" height="500" /> |
|
|
137
|
-
|
|
138
|
-
The `A11y.Container` component for configuration `UIAccessibilityContainerType` feature on iOS.
|
|
139
|
-
| Props | Description |
|
|
140
|
-
| :-- | :-- |
|
|
141
|
-
| ViewProps | Default view props, including style, testID, etc. |
|
|
142
|
-
| type?: | `none` \| `table` \| `list` \| `landmark` \| `group` — representation of `UIAccessibilityContainerType`. The default value is `group`. |
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
## A11y.View
|
|
146
|
-
`The A11y.View` component can be used to handle and track screen reader focus independently of the `A11y.Index` component.
|
|
147
|
-
|
|
148
|
-
| Prop | Description |
|
|
149
|
-
| :-- | :-- |
|
|
150
|
-
| onScreenReaderFocused | Triggered when the view gets focus from the screen reader. |
|
|
151
|
-
| onScreenReaderSubViewFocused | Triggered when a subview within the component is focused by the screen reader. |
|
|
152
|
-
| onScreenReaderSubViewBlurred | Triggered when the screen reader focus moves away or is blurred from a subview. |
|
|
153
|
-
| onScreenReaderSubViewFocusChange | Triggered when the focus status of a subview changes (either focused or blurred). |
|
|
154
|
-
| onScreenReaderDescendantFocusChanged | Triggered when any descendant subview is focused by the screen reader. Provides an object containing the focus status and the nativeId of the focused subview, if applicable. Example: < { status: string, nativeId?: string } >. |
|
|
155
|
-
|
|
156
|
-
```tsx
|
|
157
|
-
<A11y.View
|
|
158
|
-
onScreenReaderDescendantFocusChanged={(e) => console.log(e)}
|
|
159
|
-
onScreenReaderSubViewFocused={() => console.log('List has been focused')}
|
|
160
|
-
onScreenReaderSubViewBlurred={() => console.log('List has been blurred')}
|
|
161
|
-
onScreenReaderFocused={() => console.log('Focused')}
|
|
162
|
-
>
|
|
163
|
-
...
|
|
164
|
-
</A11y.View>
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## A11y.FocusFrame, A11y.FocusTrap
|
|
168
|
-
|
|
169
|
-
These components enhance accessibility by providing better control over focus management within specific areas of the screen.
|
|
170
|
-
|
|
171
|
-
- `A11y.FocusFrame`: Used at the root level of a "screen" to detect and prevent focus leaks, ensuring focus remains contained.
|
|
172
|
-
- `A11y.FocusTrap`: Wraps the content area to explicitly enforce focus confinement within a defined region.
|
|
173
|
-
|
|
174
|
-
On iOS, `A11y.FocusTrap` uses `accessibilityViewIsModal` to keep focus within the defined area. When `forceLock` is enabled, it additionally uses active enforcement — redirecting VoiceOver back into the trap whenever focus escapes and blocking focus from leaving at the system level.
|
|
175
|
-
|
|
176
|
-
On Android, `A11y.FocusTrap` uses a custom Activity or Modal to limit focus.
|
|
177
|
-
|
|
178
|
-
`A11y.FocusTrap` Props:
|
|
179
|
-
|
|
180
|
-
| Prop | Description |
|
|
181
|
-
| :-- | :-- |
|
|
182
|
-
| ViewProps | Includes all standard React Native View properties, such as style, testID, etc. |
|
|
183
|
-
| lockDisabled? | Disables the focus lock when `true`. |
|
|
184
|
-
| forceLock? | (iOS only) Enables active focus enforcement — VoiceOver is redirected back into the trap whenever focus escapes. Use when `accessibilityViewIsModal` alone is not sufficient. |
|
|
185
|
-
|
|
186
|
-
```tsx
|
|
187
|
-
<A11y.FocusFrame>
|
|
188
|
-
...
|
|
189
|
-
<A11y.FocusTrap>
|
|
190
|
-
<Text accessibilityRole="header">Locked Area</Text>
|
|
191
|
-
<Button
|
|
192
|
-
title="Confirm"
|
|
193
|
-
accessibilityLabel="Confirm action"
|
|
194
|
-
/>
|
|
195
|
-
</A11y.FocusTrap>
|
|
196
|
-
...
|
|
197
|
-
</A11y.FocusFrame>
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
Use `forceLock` when the standard lock is not enough to keep VoiceOver inside the trap:
|
|
201
|
-
|
|
202
|
-
```tsx
|
|
203
|
-
<A11y.FocusFrame>
|
|
204
|
-
...
|
|
205
|
-
<A11y.FocusTrap forceLock>
|
|
206
|
-
<Text accessibilityRole="header">Locked Area</Text>
|
|
207
|
-
<Button
|
|
208
|
-
title="Confirm"
|
|
209
|
-
accessibilityLabel="Confirm action"
|
|
210
|
-
/>
|
|
211
|
-
</A11y.FocusTrap>
|
|
212
|
-
...
|
|
213
|
-
</A11y.FocusFrame>
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
## A11y.PaneTitle, A11y.ScreenChange
|
|
32
|
+
Get started with the [getting started guide](./docs/getting-started/getting-started.md) or jump straight to the [component overview](./docs/guides/overview.md).
|
|
217
33
|
|
|
218
|
-
|
|
34
|
+
## What's available
|
|
219
35
|
|
|
220
|
-
|
|
221
|
-
React Native currently lacks built-in APIs for announcing modal or screen transitions. To enhance accessibility, you can use A11y.PaneTitle or A11y.ScreenChange:
|
|
222
|
-
- Screen transitions: Announce navigation to a new screen (e.g., "Login Screen").
|
|
223
|
-
- Modal presentations: Announce when a modal appears (e.g., "Confirm Modal").
|
|
224
|
-
|
|
225
|
-
| Prop | Description |
|
|
36
|
+
| Export | Purpose |
|
|
226
37
|
| :-- | :-- |
|
|
227
|
-
|
|
|
228
|
-
|
|
|
229
|
-
|
|
|
230
|
-
|
|
|
231
|
-
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
```tsx
|
|
237
|
-
export const LoginScreen = ({ navigation }) => {
|
|
238
|
-
const isFocused = useIsFocused();
|
|
239
|
-
return (
|
|
240
|
-
<View>
|
|
241
|
-
<A11y.ScreenChange
|
|
242
|
-
title="Login Screen"
|
|
243
|
-
displayed={isFocused}
|
|
244
|
-
/>
|
|
245
|
-
<View style={styles.container}>
|
|
246
|
-
<Text>Welcome to the Login Screen</Text>
|
|
247
|
-
<Button title="Continue" onPress={() => navigation.navigate('Home')} />
|
|
248
|
-
</View>
|
|
249
|
-
</View>
|
|
250
|
-
);
|
|
251
|
-
};
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
## A11yModule
|
|
255
|
-
`A11yModule` provides an alternative solution for reliably announcing information on iOS.
|
|
256
|
-
|
|
257
|
-
The default `AccessibilityInfo.announceForAccessibility` function on iOS can often be disrupted by focus changes. For instance, announcements might get interrupted by actions such as navigating between screens or opening a modal.
|
|
258
|
-
|
|
259
|
-
To overcome this limitation, `A11yModule.announce` is implemented with a custom solution that leverages native events, ensuring that announcements are delivered reliably and are less likely to be interrupted.
|
|
260
|
-
|
|
261
|
-
| Function | Description |
|
|
262
|
-
| :-- | :-- |
|
|
263
|
-
| announce(message: string): void | Posts a message to be announced by the screen reader with improved reliability on iOS. |
|
|
264
|
-
|
|
265
|
-
```tsx
|
|
266
|
-
A11yModule.announce('This is a custom announcement, now more reliable on iOS!');
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Migration
|
|
270
|
-
|
|
271
|
-
<details>
|
|
272
|
-
<summary>Why?</summary>
|
|
273
|
-
|
|
274
|
-
The previous versions of this library used native modules to update order, but in a world with Fabric components and new architecture, there is no visible future for managing native components via modules or `findNodeHandler`.
|
|
275
|
-
|
|
276
|
-
I thought a lot about retaining the previous API for support and compatibility, but after investigation, it was decided to deprecate the 'old' API and remove it in future releases.
|
|
277
|
-
|
|
278
|
-
The new approach is better: we no longer need to manage refs, worry about attaching nodes to the screen, and it works natively. Additionally, this new approach follows the React Native concept, which will make it easier to support in the future (hello there: bridgeless).
|
|
38
|
+
| [`A11y.Order`](./docs/guides/a11y-order.md) | Container that defines a named focus-order sequence. |
|
|
39
|
+
| [`A11y.Index`](./docs/components/A11yIndex.md) | Positioned slot within an `A11y.Order` sequence. |
|
|
40
|
+
| [`A11y.View`](./docs/components/A11yView.md) | Standalone view with screen reader focus events; no ordering. |
|
|
41
|
+
| [`A11y.Card`](./docs/components/A11yCard.md) | Card that keeps both a card-level action and nested buttons accessible simultaneously. |
|
|
42
|
+
| [`A11y.FocusTrap`](./docs/components/A11yFocusTrap.md) | Confines screen reader focus to a subtree (modal/overlay). |
|
|
43
|
+
| [`A11y.FocusFrame`](./docs/components/A11yFocusTrap.md) | Root boundary required by `A11y.FocusTrap`; detects focus escaping the region. |
|
|
44
|
+
| [`A11y.PaneTitle`](./docs/components/A11yPaneTitle.md) | Announces screen or panel transitions to VoiceOver/TalkBack. |
|
|
45
|
+
| [`A11y.ScreenChange`](./docs/components/A11yPaneTitle.md) | Shorthand for `A11y.PaneTitle` with `type="activity"` pre-set. |
|
|
46
|
+
| [`A11yModule`](./docs/leftovers/announce.md) | Reliable programmatic announcements on iOS. |
|
|
279
47
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
1. Update: `A11yOrder` to `A11y.Order`
|
|
283
|
-
|
|
284
|
-
```js
|
|
285
|
-
Previous: <A11yOrder a11yOrder={a11yOrder}>
|
|
286
|
-
Now: <A11y.Order>
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
2. Wrap components in `A11y.Index`
|
|
290
|
-
|
|
291
|
-
```js
|
|
292
|
-
Previous: <Text style={styles.font} ref={refs[0]}>
|
|
293
|
-
First
|
|
294
|
-
</Text>
|
|
295
|
-
Now: <A11y.Index index={1}>
|
|
296
|
-
<Text style={styles.font} ref={refs[0]}>
|
|
297
|
-
First
|
|
298
|
-
</Text>
|
|
299
|
-
</A11y.Index>
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
3. Remove unnecessary refs
|
|
303
|
-
|
|
304
|
-
```js
|
|
305
|
-
<A11y.Index index={1}>
|
|
306
|
-
<Text style={styles.font}>
|
|
307
|
-
First
|
|
308
|
-
</Text>
|
|
309
|
-
</A11y.Index>
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
4. Remove deprecated hooks and utilities: `useFocusOrder`, `useDynamicFocusOrder`, `useA11yOrderManager`.
|
|
313
|
-
|
|
314
|
-
That's all. The index changes, removals, etc., should work out of the box.
|
|
315
|
-
|
|
316
|
-
## Legacy
|
|
317
|
-
#### A11y.Group
|
|
318
|
-
|
|
319
|
-
`A11y.Group` (`A11y.Container`) can be used to enhance the experience of screen readers navigating through `ScrollView` or `FlatList` with the horizontal property enabled. You can skip this if you are using the new architecture; however, it is the best for applications that have not yet migrated.
|
|
320
|
-
|
|
321
|
-
| View | A11y.Group |
|
|
322
|
-
| --------------------------------------------------------- | ------------------------------------------------------------- |
|
|
323
|
-
| <img src="/.github/images/horizontal-scroll-view.gif" height="500" /> | <img src="/.github/images/horizontal-scroll-group.gif" height="500" /> |
|
|
324
|
-
|
|
325
|
-
```js
|
|
326
|
-
import { A11y, IndexCommands } from 'react-native-a11y-order';
|
|
327
|
-
|
|
328
|
-
// ...
|
|
329
|
-
|
|
330
|
-
export default function App() {
|
|
331
|
-
return (
|
|
332
|
-
<ScrollView
|
|
333
|
-
style={styles.slider}
|
|
334
|
-
contentContainerStyle={styles.sliderContainer}
|
|
335
|
-
horizontal
|
|
336
|
-
>
|
|
337
|
-
<A11y.Group style={styles.slide}>
|
|
338
|
-
<View>
|
|
339
|
-
<Text>Title: 1</Text>
|
|
340
|
-
</View>
|
|
341
|
-
<View>
|
|
342
|
-
<Text>Description: 1</Text>
|
|
343
|
-
</View>
|
|
344
|
-
</A11y.Group>
|
|
345
|
-
<A11y.Group style={styles.slide}>
|
|
346
|
-
<View>
|
|
347
|
-
<Text>Title: 2</Text>
|
|
348
|
-
</View>
|
|
349
|
-
<View>
|
|
350
|
-
<Text>Description: 2</Text>
|
|
351
|
-
</View>
|
|
352
|
-
</A11y.Group>
|
|
353
|
-
</ScrollView>
|
|
354
|
-
);
|
|
355
|
-
}
|
|
356
|
-
```
|
|
48
|
+
---
|
|
357
49
|
|
|
50
|
+
## Documentation
|
|
358
51
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
52
|
+
- [Getting started](./docs/getting-started/getting-started.md)
|
|
53
|
+
- [Component overview](./docs/guides/overview.md)
|
|
54
|
+
- [Guides](./docs/README.md#guides)
|
|
55
|
+
- [Component API reference](./docs/components/overview.md)
|
|
56
|
+
- [Migration guide](./docs/migration/migration.md)
|
|
363
57
|
|
|
364
|
-
|
|
365
|
-
## Roadmap
|
|
366
|
-
* Add autofocus prop
|
|
367
|
-
* Refactor and optimize performance
|
|
368
|
-
* Add documentation and descriptive examples
|
|
58
|
+
---
|
|
369
59
|
|
|
370
60
|
## Contributing
|
|
371
61
|
|
|
@@ -2,13 +2,11 @@ package com.a11yorder;
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import com.a11yorder.modules.A11yAnnounceModule;
|
|
5
|
-
import com.a11yorder.views.
|
|
6
|
-
import com.a11yorder.views.A11yGroupView.A11yGroupViewManager;
|
|
5
|
+
import com.a11yorder.views.A11yCardView.A11yCardViewManager;
|
|
7
6
|
import com.a11yorder.views.A11yIndexView.A11yIndexViewManager;
|
|
8
7
|
import com.a11yorder.views.A11yLockView.A11yLockViewManager;
|
|
9
8
|
import com.a11yorder.views.A11yOrderView.A11yOrderViewManager;
|
|
10
9
|
import com.a11yorder.views.A11yPaneTitle.A11yPaneTitleManager;
|
|
11
|
-
import com.a11yorder.views.A11yView.A11yViewManager;
|
|
12
10
|
import com.facebook.react.module.model.ReactModuleInfo;
|
|
13
11
|
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
14
12
|
import com.facebook.react.uimanager.ViewManager;
|
|
@@ -29,11 +27,9 @@ public class A11yOrderPackage extends TurboReactPackage {
|
|
|
29
27
|
List<ViewManager> viewManagers = new ArrayList<>();
|
|
30
28
|
viewManagers.add(new A11yIndexViewManager());
|
|
31
29
|
viewManagers.add(new A11yOrderViewManager());
|
|
32
|
-
viewManagers.add(new A11yGroupViewManager());
|
|
33
|
-
viewManagers.add(new A11yUIContainerViewManager());
|
|
34
30
|
viewManagers.add(new A11yPaneTitleManager());
|
|
35
|
-
viewManagers.add(new A11yViewManager());
|
|
36
31
|
viewManagers.add(new A11yLockViewManager());
|
|
32
|
+
viewManagers.add(new A11yCardViewManager());
|
|
37
33
|
|
|
38
34
|
return viewManagers;
|
|
39
35
|
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
package com.a11yorder.core;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.view.View;
|
|
5
|
+
import android.view.accessibility.AccessibilityEvent;
|
|
6
|
+
|
|
7
|
+
import com.a11yorder.services.focus.A11yFocusDelegate;
|
|
8
|
+
import com.a11yorder.services.focus.A11yFocusProtocol;
|
|
9
|
+
import com.facebook.react.bridge.ReactContext;
|
|
10
|
+
|
|
11
|
+
public class A11yAutoFocusView extends A11yScreenReaderView implements A11yFocusProtocol {
|
|
12
|
+
private final A11yFocusDelegate a11yFocusDelegate;
|
|
13
|
+
private Boolean autoFocus = false;
|
|
14
|
+
private Boolean autoFocusOnce = false;
|
|
15
|
+
private Boolean hasBeenFocused = false;
|
|
16
|
+
|
|
17
|
+
public A11yAutoFocusView(Context context) {
|
|
18
|
+
super(context);
|
|
19
|
+
this.a11yFocusDelegate = new A11yFocusDelegate((ReactContext) context, this);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Override
|
|
23
|
+
public boolean isViewFocused() {
|
|
24
|
+
View focusTarget = this.isFocusable() ? this : this.getSubChild();
|
|
25
|
+
if (focusTarget == null) return false;
|
|
26
|
+
return focusTarget.isAccessibilityFocused();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public void setAutoFocus(Boolean value) {
|
|
30
|
+
this.autoFocus = value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public void focus() {
|
|
34
|
+
a11yFocusDelegate.requestFocus();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Override
|
|
38
|
+
public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
|
|
39
|
+
int eventType = event.getEventType();
|
|
40
|
+
|
|
41
|
+
if (eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED && autoFocus && !hasBeenFocused) {
|
|
42
|
+
hasBeenFocused = true;
|
|
43
|
+
a11yFocusDelegate.onFocused();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return super.onRequestSendAccessibilityEvent(child, event);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Override
|
|
50
|
+
protected void onAttachedToWindow() {
|
|
51
|
+
super.onAttachedToWindow();
|
|
52
|
+
if (autoFocus && !autoFocusOnce) {
|
|
53
|
+
autoFocusOnce = true;
|
|
54
|
+
|
|
55
|
+
if (!isViewFocused()) {
|
|
56
|
+
hasBeenFocused = false;
|
|
57
|
+
a11yFocusDelegate.requestFocus();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,28 +1,18 @@
|
|
|
1
|
-
package com.a11yorder.
|
|
2
|
-
|
|
1
|
+
package com.a11yorder.core;
|
|
3
2
|
|
|
4
3
|
import android.content.Context;
|
|
5
4
|
import android.view.View;
|
|
6
5
|
import android.view.accessibility.AccessibilityEvent;
|
|
7
6
|
|
|
8
|
-
import com.a11yorder.core.A11yViewGroup;
|
|
9
7
|
import com.a11yorder.events.EventHelper;
|
|
10
|
-
import com.a11yorder.services.focus.A11yFocusDelegate;
|
|
11
|
-
import com.a11yorder.services.focus.A11yFocusProtocol;
|
|
12
8
|
import com.facebook.react.bridge.ReactContext;
|
|
13
9
|
|
|
14
|
-
public class
|
|
10
|
+
public class A11yScreenReaderView extends A11yViewGroup {
|
|
15
11
|
private final Context context;
|
|
16
|
-
private final A11yFocusDelegate a11yFocusDelegate;
|
|
17
|
-
private Boolean autoFocus = false;
|
|
18
|
-
|
|
19
|
-
private Boolean autoFocusOnce = false;
|
|
20
|
-
private Boolean hasBeenFocused = false;
|
|
21
12
|
|
|
22
|
-
public
|
|
13
|
+
public A11yScreenReaderView(Context context) {
|
|
23
14
|
super(context);
|
|
24
15
|
this.context = context;
|
|
25
|
-
this.a11yFocusDelegate = new A11yFocusDelegate((ReactContext) context, this);
|
|
26
16
|
}
|
|
27
17
|
|
|
28
18
|
public static String getNativeIdSafe(View view) {
|
|
@@ -34,20 +24,6 @@ public class A11yView extends A11yViewGroup implements A11yFocusProtocol {
|
|
|
34
24
|
}
|
|
35
25
|
}
|
|
36
26
|
|
|
37
|
-
public boolean isViewFocused() {
|
|
38
|
-
View focusTarget = this.isFocusable() ? this : this.getChildAt(0);
|
|
39
|
-
if (focusTarget == null) return false;
|
|
40
|
-
return focusTarget.isAccessibilityFocused();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
public void setAutoFocus(Boolean value) {
|
|
44
|
-
this.autoFocus = value;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
public void focus() {
|
|
48
|
-
a11yFocusDelegate.requestFocus();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
27
|
@Override
|
|
52
28
|
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
|
|
53
29
|
super.onPopulateAccessibilityEvent(event);
|
|
@@ -62,11 +38,6 @@ public class A11yView extends A11yViewGroup implements A11yFocusProtocol {
|
|
|
62
38
|
int eventType = event.getEventType();
|
|
63
39
|
boolean isSubChild = (child == this.getSubChild());
|
|
64
40
|
|
|
65
|
-
if (eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED && autoFocus && !hasBeenFocused) {
|
|
66
|
-
hasBeenFocused = true;
|
|
67
|
-
a11yFocusDelegate.onFocused();
|
|
68
|
-
}
|
|
69
|
-
|
|
70
41
|
if (eventType == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED && isSubChild) {
|
|
71
42
|
EventHelper.screenReaderFocusChanged((ReactContext) context, this.getId(), true);
|
|
72
43
|
}
|
|
@@ -87,17 +58,4 @@ public class A11yView extends A11yViewGroup implements A11yFocusProtocol {
|
|
|
87
58
|
|
|
88
59
|
return super.onRequestSendAccessibilityEvent(child, event);
|
|
89
60
|
}
|
|
90
|
-
|
|
91
|
-
@Override
|
|
92
|
-
protected void onAttachedToWindow() {
|
|
93
|
-
super.onAttachedToWindow();
|
|
94
|
-
if (autoFocus && !autoFocusOnce) {
|
|
95
|
-
autoFocusOnce = true;
|
|
96
|
-
|
|
97
|
-
if (!isViewFocused()) {
|
|
98
|
-
hasBeenFocused = false;
|
|
99
|
-
a11yFocusDelegate.requestFocus();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
61
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
package com.a11yorder.core;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.view.View;
|
|
5
|
+
|
|
6
|
+
import com.a11yorder.services.order.A11yOrderService;
|
|
7
|
+
|
|
8
|
+
public class A11yViewOrder extends A11yAutoFocusView {
|
|
9
|
+
private final A11yOrderService orderService;
|
|
10
|
+
|
|
11
|
+
public A11yViewOrder(Context context) {
|
|
12
|
+
super(context);
|
|
13
|
+
this.orderService = new A11yOrderService(this);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public void setIndex(int index) {
|
|
17
|
+
this.orderService.setIndex(index);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public void setOrderFocusType(int focusType) {
|
|
21
|
+
this.orderService.setFocusType(focusType);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public void setOrderKey(String orderKey) {
|
|
25
|
+
this.orderService.setOrderKey(orderKey);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Override
|
|
29
|
+
protected void onChildAttached(View child) {
|
|
30
|
+
this.orderService.link(child);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Override
|
|
34
|
+
protected void onChildRemoved() {
|
|
35
|
+
this.orderService.detach();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
package com.a11yorder.views.A11yCardView;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import android.view.ViewGroup;
|
|
6
|
+
|
|
7
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
8
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
9
|
+
|
|
10
|
+
@ReactModule(name = com.a11yorder.views.A11yCardView.A11yCardViewManager.NAME)
|
|
11
|
+
public class A11yCardViewManager extends com.a11yorder.A11yCardViewManagerSpec<ViewGroup> {
|
|
12
|
+
public static final String NAME = "A11yCardView";
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public String getName() {
|
|
16
|
+
return NAME;
|
|
17
|
+
}
|
|
18
|
+
}
|