react-native-a11y-order 0.6.0 → 0.7.1-rc
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.
Potentially problematic release.
This version of react-native-a11y-order might be problematic. Click here for more details.
- package/README.md +294 -28
- package/android/src/main/java/com/a11yorder/A11yOrderPackage.java +38 -6
- package/android/src/main/java/com/a11yorder/core/A11yViewGroup.java +73 -0
- package/android/src/main/java/com/a11yorder/events/EventHelper.java +42 -0
- package/android/src/main/java/com/a11yorder/events/ScreenReaderDescendantFocusChangedEvent.java +32 -0
- package/android/src/main/java/com/a11yorder/events/ScreenReaderFocusChangedEvent.java +26 -0
- package/android/src/main/java/com/a11yorder/events/ScreenReaderFocusedEvent.java +23 -0
- package/android/src/main/java/com/a11yorder/modules/A11yAnnounceModule.java +29 -0
- package/android/src/main/java/com/a11yorder/services/order/A11yOrderService.java +16 -15
- package/android/src/main/java/com/a11yorder/utils/A11yHelper.java +40 -6
- package/android/src/main/java/com/a11yorder/views/A11yIndexView/A11yIndexView.java +21 -0
- package/android/src/main/java/com/a11yorder/views/A11yIndexView/A11yIndexViewManager.java +15 -1
- package/android/src/main/java/com/a11yorder/views/A11yLockView/A11yLockService.java +44 -0
- package/android/src/main/java/com/a11yorder/views/A11yLockView/A11yLockView.java +115 -0
- package/android/src/main/java/com/a11yorder/views/A11yLockView/A11yLockViewManager.java +38 -0
- package/android/src/main/java/com/a11yorder/views/{A11yContainerView/A11yContainerViewManager.java → A11yUIContainerView/A11yUIContainerViewManager.java} +4 -4
- package/android/src/main/java/com/a11yorder/views/A11yView/A11yView.java +47 -6
- package/android/src/main/java/com/a11yorder/views/A11yView/A11yViewManager.java +24 -3
- package/android/src/newarch/A11yAnnounceModuleSpec.java +9 -0
- package/android/src/newarch/A11yLockViewManagerSpec.java +12 -0
- package/android/src/newarch/A11yUIContainerViewManagerSpec.java +8 -0
- package/android/src/oldarch/A11yAnnounceModuleSpec.java +12 -0
- package/android/src/oldarch/A11yLockViewManagerSpec.java +13 -0
- package/android/src/oldarch/{A11yContainerViewManagerSpec.java → A11yUIContainerViewManagerSpec.java} +1 -1
- package/android/src/oldarch/A11yViewSpec.java +2 -0
- package/ios/delegates/RNAOScreenReaderFocusDelegate.h +17 -0
- package/ios/delegates/RNAOViewItemDelegate/RNAOViewItemDelegate.h +28 -0
- package/ios/delegates/RNAOViewItemDelegate/RNAOViewItemDelegate.mm +98 -0
- package/ios/delegates/RNAOViewItemDelegate/RNAOViewItemProtocol.h +18 -0
- package/ios/extensions/RCTModalHostViewComponentView+RNAOA11yOrder.h +30 -0
- package/ios/extensions/RCTModalHostViewComponentView+RNAOA11yOrder.mm +82 -0
- package/ios/extensions/UIView+RNAOA11yOrder.h +19 -0
- package/ios/extensions/UIView+RNAOA11yOrder.mm +80 -0
- package/ios/extensions/UIViewController+RNAOA11yOrder.mm +26 -4
- package/ios/helpers/RNAOFabricEventHelper/RNAOFabricEventHelper.h +28 -0
- package/ios/helpers/RNAOFabricEventHelper/RNAOFabricEventHelper.mm +65 -0
- package/ios/helpers/RNAOFocusChangeListener.h +25 -0
- package/ios/helpers/RNAOFocusChangeListener.mm +47 -0
- package/ios/modules/RNAOA11yAnnounceModule.h +34 -0
- package/ios/modules/RNAOA11yAnnounceModule.mm +40 -0
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceHelper.h +19 -0
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceHelper.mm +28 -0
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceQueue.h +22 -0
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceQueue.mm +43 -0
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceService.h +25 -0
- package/ios/services/RNAOA11yAnnounceService/RNAOA11yAnnounceService.mm +111 -0
- package/ios/services/RNAOA11yFocusService/RNAOA11yFocusService.h +23 -0
- package/ios/services/RNAOA11yFocusService/RNAOA11yFocusService.m +85 -0
- package/ios/services/RNAOA11yItemDelegate/RNAOA11yItemDelegate.h +3 -1
- package/ios/services/RNAOA11yItemDelegate/RNAOA11yItemDelegate.mm +11 -3
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.h +5 -3
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexView.mm +27 -4
- package/ios/views/RNAOA11yIndexView/RNAOA11yIndexViewManager.mm +2 -0
- package/ios/views/RNAOA11yLockView/RNAOA11yLockView.h +38 -0
- package/ios/views/RNAOA11yLockView/RNAOA11yLockView.mm +62 -0
- package/ios/views/RNAOA11yLockView/RNAOA11yLockViewManager.h +14 -0
- package/ios/views/RNAOA11yLockView/RNAOA11yLockViewManager.mm +25 -0
- package/ios/views/RNAOA11yPaneTitleView/RNAOA11yPaneTitleView.h +2 -0
- package/ios/views/RNAOA11yPaneTitleView/RNAOA11yPaneTitleView.mm +16 -4
- package/ios/views/{RNAOA11yContainerView/RNAOA11yContainerView.h → RNAOA11yUIContainerView/RNAOA11yUIContainerView.h} +6 -6
- package/ios/views/{RNAOA11yContainerView/RNAOA11yContainerView.mm → RNAOA11yUIContainerView/RNAOA11yUIContainerView.mm} +11 -11
- package/ios/views/RNAOA11yUIContainerView/RNAOA11yUIContainerViewManager.h +18 -0
- package/ios/views/{RNAOA11yContainerView/RNAOA11yContainerViewManager.mm → RNAOA11yUIContainerView/RNAOA11yUIContainerViewManager.mm} +6 -6
- package/ios/views/RNAOA11yView/RNAOA11yView.h +11 -3
- package/ios/views/RNAOA11yView/RNAOA11yView.mm +167 -12
- package/ios/views/RNAOA11yView/RNAOA11yViewManager.mm +19 -8
- package/lib/commonjs/components/A11yGroup/A11yGroup.ios.js +2 -2
- package/lib/commonjs/components/A11yGroup/A11yGroup.ios.js.map +1 -1
- package/lib/commonjs/components/A11yIndex/A11yIndex.js +16 -1
- package/lib/commonjs/components/A11yIndex/A11yIndex.js.map +1 -1
- package/lib/commonjs/components/A11yLock/A11yBaseLock/A11yBaseLock.android.js +22 -0
- package/lib/commonjs/components/A11yLock/A11yBaseLock/A11yBaseLock.android.js.map +1 -0
- package/lib/commonjs/components/A11yLock/A11yBaseLock/A11yBaseLock.js +9 -0
- package/lib/commonjs/components/A11yLock/A11yBaseLock/A11yBaseLock.js.map +1 -0
- package/lib/commonjs/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.js +21 -0
- package/lib/commonjs/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.js.map +1 -0
- package/lib/commonjs/components/A11yLock/A11yFocusFrame/A11yFocusFrame.js +13 -0
- package/lib/commonjs/components/A11yLock/A11yFocusFrame/A11yFocusFrame.js.map +1 -0
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.js +19 -0
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.js.map +1 -0
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrap.js +17 -0
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrap.js.map +1 -0
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.js +46 -0
- package/lib/commonjs/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.js.map +1 -0
- package/lib/commonjs/components/A11yPaneTitle/A11yPaneTitle.js +3 -0
- package/lib/commonjs/components/A11yPaneTitle/A11yPaneTitle.js.map +1 -1
- package/lib/commonjs/components/{A11yContainer/A11yContainer.ios.js → A11yUIContainer/A11yUIContainer.ios.js} +7 -7
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.ios.js.map +1 -0
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.js +9 -0
- package/lib/commonjs/components/A11yUIContainer/A11yUIContainer.js.map +1 -0
- package/lib/commonjs/components/A11yView/A11yView.js +27 -3
- package/lib/commonjs/components/A11yView/A11yView.js.map +1 -1
- package/lib/commonjs/context/A11yFocusFrameProviderContext.js +28 -0
- package/lib/commonjs/context/A11yFocusFrameProviderContext.js.map +1 -0
- package/lib/commonjs/index.js +14 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/A11yAnnounceModule.android.js +11 -0
- package/lib/commonjs/modules/A11yAnnounceModule.android.js.map +1 -0
- package/lib/commonjs/modules/A11yAnnounceModule.js +28 -0
- package/lib/commonjs/modules/A11yAnnounceModule.js.map +1 -0
- package/lib/commonjs/nativeSpecs/A11yIndexNativeComponent.js.map +1 -1
- package/lib/commonjs/nativeSpecs/{A11yContainerNativeComponent.js → A11yLockNativeComponent.js} +2 -2
- package/lib/commonjs/nativeSpecs/A11yLockNativeComponent.js.map +1 -0
- package/lib/commonjs/nativeSpecs/A11yUIContainerNativeComponent.js +10 -0
- package/lib/commonjs/nativeSpecs/A11yUIContainerNativeComponent.js.map +1 -0
- package/lib/commonjs/nativeSpecs/A11yViewNativeComponent.js.map +1 -1
- package/lib/commonjs/nativeSpecs/NativeA11yAnnounceModule.js +9 -0
- package/lib/commonjs/nativeSpecs/NativeA11yAnnounceModule.js.map +1 -0
- package/lib/commonjs/types/A11yLock.types.js +6 -0
- package/lib/commonjs/types/A11yLock.types.js.map +1 -0
- package/lib/commonjs/types/{A11yContainerView.types.js → A11yUIContainerView.types.js} +1 -1
- package/lib/commonjs/types/A11yUIContainerView.types.js.map +1 -0
- package/lib/commonjs/types/A11yView.types.js +6 -0
- package/lib/commonjs/types/A11yView.types.js.map +1 -0
- package/lib/module/components/A11yGroup/A11yGroup.ios.js +2 -2
- package/lib/module/components/A11yGroup/A11yGroup.ios.js.map +1 -1
- package/lib/module/components/A11yIndex/A11yIndex.js +16 -1
- package/lib/module/components/A11yIndex/A11yIndex.js.map +1 -1
- package/lib/module/components/A11yLock/A11yBaseLock/A11yBaseLock.android.js +15 -0
- package/lib/module/components/A11yLock/A11yBaseLock/A11yBaseLock.android.js.map +1 -0
- package/lib/module/components/A11yLock/A11yBaseLock/A11yBaseLock.js +3 -0
- package/lib/module/components/A11yLock/A11yBaseLock/A11yBaseLock.js.map +1 -0
- package/lib/module/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.js +14 -0
- package/lib/module/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.js.map +1 -0
- package/lib/module/components/A11yLock/A11yFocusFrame/A11yFocusFrame.js +5 -0
- package/lib/module/components/A11yLock/A11yFocusFrame/A11yFocusFrame.js.map +1 -0
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.js +12 -0
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.js.map +1 -0
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrap.js +9 -0
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrap.js.map +1 -0
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.js +39 -0
- package/lib/module/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.js.map +1 -0
- package/lib/module/components/A11yPaneTitle/A11yPaneTitle.js +3 -0
- package/lib/module/components/A11yPaneTitle/A11yPaneTitle.js.map +1 -1
- package/lib/module/components/{A11yContainer/A11yContainer.ios.js → A11yUIContainer/A11yUIContainer.ios.js} +5 -5
- package/lib/module/components/A11yUIContainer/A11yUIContainer.ios.js.map +1 -0
- package/lib/module/components/A11yUIContainer/A11yUIContainer.js +3 -0
- package/lib/module/components/A11yUIContainer/A11yUIContainer.js.map +1 -0
- package/lib/module/components/A11yView/A11yView.js +27 -3
- package/lib/module/components/A11yView/A11yView.js.map +1 -1
- package/lib/module/context/A11yFocusFrameProviderContext.js +20 -0
- package/lib/module/context/A11yFocusFrameProviderContext.js.map +1 -0
- package/lib/module/index.js +8 -3
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/A11yAnnounceModule.android.js +5 -0
- package/lib/module/modules/A11yAnnounceModule.android.js.map +1 -0
- package/lib/module/modules/A11yAnnounceModule.js +21 -0
- package/lib/module/modules/A11yAnnounceModule.js.map +1 -0
- package/lib/module/nativeSpecs/A11yIndexNativeComponent.js.map +1 -1
- package/lib/module/nativeSpecs/A11yLockNativeComponent.js +3 -0
- package/lib/module/nativeSpecs/A11yLockNativeComponent.js.map +1 -0
- package/lib/module/nativeSpecs/A11yUIContainerNativeComponent.js +3 -0
- package/lib/module/nativeSpecs/A11yUIContainerNativeComponent.js.map +1 -0
- package/lib/module/nativeSpecs/A11yViewNativeComponent.js.map +1 -1
- package/lib/module/nativeSpecs/NativeA11yAnnounceModule.js +3 -0
- package/lib/module/nativeSpecs/NativeA11yAnnounceModule.js.map +1 -0
- package/lib/module/types/A11yLock.types.js +2 -0
- package/lib/module/types/A11yLock.types.js.map +1 -0
- package/lib/module/types/{A11yContainerView.types.js → A11yUIContainerView.types.js} +1 -1
- package/lib/module/types/A11yUIContainerView.types.js.map +1 -0
- package/lib/module/types/A11yView.types.js +2 -0
- package/lib/module/types/A11yView.types.js.map +1 -0
- package/lib/typescript/src/components/A11yIndex/A11yIndex.d.ts +3 -0
- package/lib/typescript/src/components/A11yIndex/A11yIndex.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yIndex/A11yIndex.web.d.ts +3 -0
- package/lib/typescript/src/components/A11yIndex/A11yIndex.web.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yLock/A11yBaseLock/A11yBaseLock.android.d.ts +4 -0
- package/lib/typescript/src/components/A11yLock/A11yBaseLock/A11yBaseLock.android.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yLock/A11yBaseLock/A11yBaseLock.d.ts +3 -0
- package/lib/typescript/src/components/A11yLock/A11yBaseLock/A11yBaseLock.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.d.ts +4 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.d.ts +4 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.d.ts +4 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.d.ts +4 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.d.ts +3 -0
- package/lib/typescript/src/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yPaneTitle/A11yPaneTitle.d.ts +3 -2
- package/lib/typescript/src/components/A11yPaneTitle/A11yPaneTitle.d.ts.map +1 -1
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.d.ts +3 -0
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.ios.d.ts +4 -0
- package/lib/typescript/src/components/A11yUIContainer/A11yUIContainer.ios.d.ts.map +1 -0
- package/lib/typescript/src/components/A11yView/A11yView.d.ts +8 -3
- package/lib/typescript/src/components/A11yView/A11yView.d.ts.map +1 -1
- package/lib/typescript/src/context/A11yFocusFrameProviderContext.d.ts +12 -0
- package/lib/typescript/src/context/A11yFocusFrameProviderContext.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +20 -6
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.web.d.ts +3 -0
- package/lib/typescript/src/index.web.d.ts.map +1 -1
- package/lib/typescript/src/modules/A11yAnnounceModule.android.d.ts +4 -0
- package/lib/typescript/src/modules/A11yAnnounceModule.android.d.ts.map +1 -0
- package/lib/typescript/src/modules/A11yAnnounceModule.d.ts +6 -0
- package/lib/typescript/src/modules/A11yAnnounceModule.d.ts.map +1 -0
- package/lib/typescript/src/nativeSpecs/A11yIndexNativeComponent.d.ts +8 -1
- package/lib/typescript/src/nativeSpecs/A11yIndexNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpecs/A11yLockNativeComponent.d.ts +10 -0
- package/lib/typescript/src/nativeSpecs/A11yLockNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/nativeSpecs/{A11yContainerNativeComponent.d.ts → A11yUIContainerNativeComponent.d.ts} +4 -4
- package/lib/typescript/src/nativeSpecs/A11yUIContainerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/nativeSpecs/A11yViewNativeComponent.d.ts +12 -0
- package/lib/typescript/src/nativeSpecs/A11yViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/nativeSpecs/NativeA11yAnnounceModule.d.ts +7 -0
- package/lib/typescript/src/nativeSpecs/NativeA11yAnnounceModule.d.ts.map +1 -0
- package/lib/typescript/src/types/A11yGroup.types.d.ts +3 -3
- package/lib/typescript/src/types/A11yGroup.types.d.ts.map +1 -1
- package/lib/typescript/src/types/A11yIndex.types.d.ts +3 -0
- package/lib/typescript/src/types/A11yIndex.types.d.ts.map +1 -1
- package/lib/typescript/src/types/A11yLock.types.d.ts +7 -0
- package/lib/typescript/src/types/A11yLock.types.d.ts.map +1 -0
- package/lib/typescript/src/types/A11yUIContainerView.types.d.ts +13 -0
- package/lib/typescript/src/types/A11yUIContainerView.types.d.ts.map +1 -0
- package/lib/typescript/src/types/A11yView.types.d.ts +12 -0
- package/lib/typescript/src/types/A11yView.types.d.ts.map +1 -0
- package/package.json +7 -3
- package/src/components/A11yGroup/A11yGroup.ios.tsx +2 -2
- package/src/components/A11yIndex/A11yIndex.tsx +39 -1
- package/src/components/A11yLock/A11yBaseLock/A11yBaseLock.android.tsx +16 -0
- package/src/components/A11yLock/A11yBaseLock/A11yBaseLock.tsx +5 -0
- package/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.android.tsx +18 -0
- package/src/components/A11yLock/A11yFocusFrame/A11yFocusFrame.tsx +9 -0
- package/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.android.tsx +12 -0
- package/src/components/A11yLock/A11yFocusTrap/A11yFocusTrap.tsx +10 -0
- package/src/components/A11yLock/A11yFocusTrap/A11yFocusTrapMountWrapper.ts +42 -0
- package/src/components/A11yPaneTitle/A11yPaneTitle.tsx +6 -1
- package/src/components/A11yUIContainer/A11yUIContainer.ios.tsx +20 -0
- package/src/components/A11yUIContainer/A11yUIContainer.tsx +5 -0
- package/src/components/A11yView/A11yView.tsx +57 -5
- package/src/context/A11yFocusFrameProviderContext.tsx +39 -0
- package/src/index.ts +13 -5
- package/src/modules/A11yAnnounceModule.android.ts +5 -0
- package/src/modules/A11yAnnounceModule.ts +32 -0
- package/src/nativeSpecs/A11yIndexNativeComponent.ts +14 -1
- package/src/nativeSpecs/A11yLockNativeComponent.ts +11 -0
- package/src/nativeSpecs/{A11yContainerNativeComponent.ts → A11yUIContainerNativeComponent.ts} +4 -4
- package/src/nativeSpecs/A11yViewNativeComponent.ts +15 -0
- package/src/nativeSpecs/NativeA11yAnnounceModule.ts +8 -0
- package/src/types/A11yGroup.types.ts +5 -6
- package/src/types/A11yIndex.types.ts +4 -0
- package/src/types/A11yLock.types.ts +7 -0
- package/src/types/A11yUIContainerView.types.ts +15 -0
- package/src/types/A11yView.types.ts +19 -0
- package/android/src/newarch/A11yContainerViewManagerSpec.java +0 -8
- package/ios/views/RNAOA11yContainerView/RNAOA11yContainerViewManager.h +0 -18
- package/lib/commonjs/components/A11yContainer/A11yContainer.ios.js.map +0 -1
- package/lib/commonjs/components/A11yContainer/A11yContainer.js +0 -9
- package/lib/commonjs/components/A11yContainer/A11yContainer.js.map +0 -1
- package/lib/commonjs/nativeSpecs/A11yContainerNativeComponent.js.map +0 -1
- package/lib/commonjs/types/A11yContainerView.types.js.map +0 -1
- package/lib/module/components/A11yContainer/A11yContainer.ios.js.map +0 -1
- package/lib/module/components/A11yContainer/A11yContainer.js +0 -3
- package/lib/module/components/A11yContainer/A11yContainer.js.map +0 -1
- package/lib/module/nativeSpecs/A11yContainerNativeComponent.js +0 -3
- package/lib/module/nativeSpecs/A11yContainerNativeComponent.js.map +0 -1
- package/lib/module/types/A11yContainerView.types.js.map +0 -1
- package/lib/typescript/src/components/A11yContainer/A11yContainer.d.ts +0 -3
- package/lib/typescript/src/components/A11yContainer/A11yContainer.d.ts.map +0 -1
- package/lib/typescript/src/components/A11yContainer/A11yContainer.ios.d.ts +0 -4
- package/lib/typescript/src/components/A11yContainer/A11yContainer.ios.d.ts.map +0 -1
- package/lib/typescript/src/nativeSpecs/A11yContainerNativeComponent.d.ts.map +0 -1
- package/lib/typescript/src/types/A11yContainerView.types.d.ts +0 -13
- package/lib/typescript/src/types/A11yContainerView.types.d.ts.map +0 -1
- package/src/components/A11yContainer/A11yContainer.ios.tsx +0 -17
- package/src/components/A11yContainer/A11yContainer.tsx +0 -5
- package/src/types/A11yContainerView.types.ts +0 -15
package/README.md
CHANGED
|
@@ -1,60 +1,201 @@
|
|
|
1
1
|
# React Native A11y Order
|
|
2
2
|
|
|
3
|
-
React Native A11y Order Library:
|
|
3
|
+
React Native A11y Order Library: Enhance screen reader functionality with advanced control.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Managing screen reader focus order can be challenging, especially in complex or unconventional scenarios. The `react-native-a11y-order` library is built with a native-first approach to resolve issues related to screen reader focus order and provide additional accessibility features on both Android and iOS platforms.
|
|
6
6
|
|
|
7
7
|
| iOS reader | Android reader |
|
|
8
8
|
| --------------------------------------------------------- | ------------------------------------------------------------- |
|
|
9
9
|
| <img src="/.github/images/ios-reader.gif" height="500" /> | <img src="/.github/images/android-reader.gif" height="500" /> |
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
- Bridgeless
|
|
13
|
+
- New architecture
|
|
14
|
+
- Old architecture
|
|
15
|
+
- Backward compatibility
|
|
16
|
+
- Compatible with Expo prebuild
|
|
17
|
+
|
|
18
|
+
> [!TIP]
|
|
19
|
+
> If you need to adjust the horizontal or vertical focus order, consider using `<View collapsable={false}>` as a quick fix.
|
|
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.
|
|
23
|
+
|
|
24
|
+
> [!IMPORTANT]
|
|
25
|
+
> Starting from React Native v0.8.2, an experimental feature `experimental_accessibilityOrder` is available for setting the correct focus order.
|
|
26
|
+
> You can find more information in the [Accessibility documentation](https://reactnative.dev/docs/accessibility).
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
```sh
|
|
32
|
+
npm install react-native-a11y-order
|
|
33
|
+
```
|
|
16
34
|
|
|
17
|
-
|
|
35
|
+
```sh
|
|
36
|
+
yarn add react-native-a11y-order
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Recent Updates
|
|
40
|
+
|
|
41
|
+
#### Screen Reader Focus Events
|
|
42
|
+
|
|
43
|
+
| iOS | Android |
|
|
18
44
|
| :-- | :-- |
|
|
19
|
-
|
|
|
20
|
-
| `legacy` | Uses the previous implementation of the element search, retrieving the first child as the accessibility element for order. |
|
|
21
|
-
| `search` | Searches for the first accessible element in the child tree. |
|
|
45
|
+
| <img src="/.github/images/screen-reader-focus-ios.gif" height="500" /> | <img src="/.github/images/screen-reader-focus-android.gif" height="500" /> |
|
|
22
46
|
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
> To enhance accessibility and provide better focus management, screen reader focus handlers have been added. These handlers allow you to capture and respond to screen reader focus events effectively, enabling features like managing animations, timers, and other interactions based on focus changes.
|
|
48
|
+
|
|
49
|
+
<details>
|
|
50
|
+
<summary>More Information</summary>
|
|
51
|
+
|
|
52
|
+
A11y.View Props:
|
|
53
|
+
| Prop | Description |
|
|
25
54
|
| :-- | :-- |
|
|
26
|
-
|
|
|
27
|
-
|
|
|
55
|
+
| onScreenReaderFocused | Triggered when the view gets focus from the screen reader. |
|
|
56
|
+
| onScreenReaderSubViewFocused | Triggered when a subview within the component is focused by the screen reader. |
|
|
57
|
+
| onScreenReaderSubViewBlurred | Triggered when the screen reader focus moves away or is blurred from a subview. |
|
|
58
|
+
| onScreenReaderSubViewFocusChange | Triggered when the focus status of a subview changes (either focused or blurred). |
|
|
59
|
+
| 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 } >. |
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
<A11y.View
|
|
63
|
+
onScreenReaderDescendantFocusChanged={(e) => console.log(e)}
|
|
64
|
+
onScreenReaderSubViewFocused={() => console.log('List has been focused')}
|
|
65
|
+
onScreenReaderSubViewBlurred={() => console.log('List has been blurred')}
|
|
66
|
+
onScreenReaderFocused={() => console.log('Focused')}
|
|
67
|
+
>
|
|
68
|
+
...
|
|
69
|
+
</A11y.View>
|
|
70
|
+
```
|
|
71
|
+
</details>
|
|
28
72
|
|
|
29
|
-
|
|
30
|
-
|
|
73
|
+
#### Focus Lock Functionality
|
|
74
|
+
|
|
75
|
+
| iOS | Android |
|
|
31
76
|
| :-- | :-- |
|
|
32
|
-
|
|
|
33
|
-
| type?: | `legacy` or `none` \| `table` \| `list` \| `landmark` \| `group` — representation of `UIAccessibilityContainerType`. The default value is `none`. |
|
|
77
|
+
| <img src="/.github/images/focus-lock-ios.gif" height="500" /> | <img src="/.github/images/focus-lock-android.gif" height="500" /> |
|
|
34
78
|
|
|
79
|
+
> The focus lock functionality has been introduced with two new components: `A11y.FocusFrame` and `A11y.FocusTrap`. These components enable more robust accessibility by managing and restricting focus within specific areas of the screen.
|
|
35
80
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- Backward compatibility
|
|
81
|
+
<details>
|
|
82
|
+
<summary>More Information</summary>
|
|
39
83
|
|
|
40
|
-
|
|
84
|
+
- On iOS, `A11y.FocusTrap` uses the native `accessibilityViewIsModal` property to keep the focus within a defined area.
|
|
85
|
+
- On Android, where no equivalent to `accessibilityViewIsModal` exists, custom logic has been implemented as a workaround. By default, Android uses a custom Activity or Modal to limit focus. While using a Modal is considered the best practice for focus locking on Android, some scenarios—such as issues with React Native's Modal or library-specific constraints—may require alternative implementations.
|
|
41
86
|
|
|
42
|
-
|
|
43
|
-
|
|
87
|
+
#### How It Works
|
|
88
|
+
|
|
89
|
+
The focus lock functionality should be used as a pair:
|
|
90
|
+
|
|
91
|
+
- `A11y.FocusFrame`: This component is used at the root level of a "screen" to detect focus leaks and ensure that focus remains contained.
|
|
92
|
+
- `A11y.FocusTrap`: This component wraps the content area where focus should be explicitly locked.
|
|
93
|
+
|
|
94
|
+
| Prop | Description |
|
|
95
|
+
| :-- | :-- |
|
|
96
|
+
| ViewProps | Includes all standard React Native View properties, such as style, testID, etc. |
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
<A11y.FocusFrame>
|
|
100
|
+
...
|
|
101
|
+
<A11y.FocusTrap>
|
|
102
|
+
<Text accessibilityRole="header">Locked Area</Text>
|
|
103
|
+
<Button
|
|
104
|
+
title="Confirm"
|
|
105
|
+
accessibilityLabel="Confirm action"
|
|
106
|
+
/>
|
|
107
|
+
</A11y.FocusTrap>
|
|
108
|
+
...
|
|
109
|
+
</A11y.FocusFrame>
|
|
44
110
|
```
|
|
45
111
|
|
|
46
|
-
|
|
47
|
-
|
|
112
|
+
</details>
|
|
113
|
+
|
|
114
|
+
#### A11y.PaneTitle and A11y.ScreenChange
|
|
115
|
+
|
|
116
|
+
| iOS | Android |
|
|
117
|
+
| :-- | :-- |
|
|
118
|
+
| <img src="/.github/images/announce-ios.gif" height="500" /> | <img src="/.github/images/announce-android.gif" height="500" /> |
|
|
119
|
+
|
|
120
|
+
> The components `A11y.PaneTitle` and `A11y.ScreenChange` have been introduced to enhance accessibility by providing robust support for announcing screen changes and their states.
|
|
121
|
+
|
|
122
|
+
<details>
|
|
123
|
+
<summary>More Information</summary>
|
|
124
|
+
|
|
125
|
+
Platform-Specific Behavior
|
|
126
|
+
-On Android, `A11y.PaneTitle` and `A11y.ScreenChange` utilize native properties, specifically: `activity.setTitle` and `setAccessibilityPaneTitle`.
|
|
127
|
+
- On iOS, due to the lack of equivalent native functionality, `A11yModule.announce` is used as a workaround to announce screen changes (see the `A11yModule.announce` section for details).
|
|
128
|
+
|
|
129
|
+
##### When to Use:
|
|
130
|
+
|
|
131
|
+
Currently, React Native doesn't provide APIs for announcing modal or screen transitions. To address this and improve accessibility, you can use `A11y.PaneTitle` or `A11y.ScreenChange` to announce:
|
|
132
|
+
- Screen transitions, such as navigating to a new screen (e.g., "Login Screen").
|
|
133
|
+
- Modal presentations, such as when a modal appears (e.g., "Confirm Modal").
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
A11y.PaneTitle Props
|
|
137
|
+
| Prop | Description |
|
|
138
|
+
| :-- | :-- |
|
|
139
|
+
| title | The title message to be announced for the screen or modal. |
|
|
140
|
+
| detachMessage | The message to be announced when this component is detached (e.g., when leaving the screen). |
|
|
141
|
+
| type | The type of announcement for Android. Options: activity, pane, or announce. |
|
|
142
|
+
| displayed | A trigger for screen focus changes, used to properly update the Android Activity title when switching screens. |
|
|
143
|
+
| withFocusRestore | Ensures that the screen reader focus is preserved and restored appropriately after a screen change. (iOS-specific) |
|
|
144
|
+
|
|
145
|
+
The A11y.ScreenChange component is a specialized implementation of A11y.PaneTitle. It is preconfigured with `type="activity"` for screen change announcements on Android and works identically to `A11y.PaneTitle`.
|
|
146
|
+
|
|
147
|
+
Example:
|
|
148
|
+
```tsx
|
|
149
|
+
export const LoginScreen = ({ navigation }) => {
|
|
150
|
+
const isFocused = useIsFocused();
|
|
151
|
+
return (
|
|
152
|
+
<View>
|
|
153
|
+
<A11y.ScreenChange
|
|
154
|
+
title="Login Screen"
|
|
155
|
+
displayed={isFocused}
|
|
156
|
+
/>
|
|
157
|
+
<View style={styles.container}>
|
|
158
|
+
<Text>Welcome to the Login Screen</Text>
|
|
159
|
+
<Button title="Continue" onPress={() => navigation.navigate('Home')} />
|
|
160
|
+
</View>
|
|
161
|
+
</View>
|
|
162
|
+
);
|
|
163
|
+
};
|
|
48
164
|
```
|
|
165
|
+
</details>
|
|
166
|
+
|
|
167
|
+
#### A11yModule.announce - Alternative Announcement Function
|
|
49
168
|
|
|
50
|
-
|
|
169
|
+
> The `A11yModule.announce` function has been introduced to improve accessibility announcement behavior on iOS.
|
|
170
|
+
|
|
171
|
+
<details>
|
|
172
|
+
<summary>More Information</summary>
|
|
173
|
+
Why Use `A11yModule.announce`?
|
|
174
|
+
|
|
175
|
+
On iOS, the default `AccessibilityInfo.announceForAccessibility` function can be interrupted by focus changes. This means that if you attempt to announce a message, the announcement could be prematurely cut off due to various events, such as screen navigation or the display of a modal.
|
|
176
|
+
|
|
177
|
+
To address this limitation, `A11yModule.announce` uses a custom solution built on native events to ensure that announcements are made reliably and are less likely to be interrupted.
|
|
178
|
+
|
|
179
|
+
A11yModule API:
|
|
180
|
+
| Function | Description |
|
|
181
|
+
| :-- | :-- |
|
|
182
|
+
| announce(message: string): void | Posts a string to be announced by the screen reader, ensuring improved reliability on iOS. |
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
A11yModule.announce('This is a custom announcement, now more reliable on iOS!');
|
|
186
|
+
```
|
|
187
|
+
</details>
|
|
51
188
|
|
|
52
189
|
|
|
53
190
|
## Usage
|
|
54
191
|
|
|
55
192
|
#### A11y.Order, A11y.Index
|
|
56
193
|
|
|
57
|
-
|
|
194
|
+
To set the focus order for a screen reader in React Native, you can use the following components:
|
|
195
|
+
- `A11y.Order`: A container component that creates an ordering group for focusable elements.
|
|
196
|
+
- `A11y.Index`: A wrapper component that defines the position of an element within the ordering group.
|
|
197
|
+
|
|
198
|
+
Using these components together simplifies the process of managing focus order in complex UI structures.
|
|
58
199
|
|
|
59
200
|
To illustrate, let's look at an example:
|
|
60
201
|
|
|
@@ -91,7 +232,7 @@ export default function App() {
|
|
|
91
232
|
}
|
|
92
233
|
```
|
|
93
234
|
|
|
94
|
-
Additionally, for dynamic interaction scenarios, setting focus
|
|
235
|
+
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.
|
|
95
236
|
|
|
96
237
|
```js
|
|
97
238
|
import { A11y, IndexCommands } from 'react-native-a11y-order';
|
|
@@ -115,6 +256,30 @@ export default function App() {
|
|
|
115
256
|
);
|
|
116
257
|
}
|
|
117
258
|
```
|
|
259
|
+
A11y.Index Props:
|
|
260
|
+
| Prop | Description |
|
|
261
|
+
| :-- | :-- |
|
|
262
|
+
| ViewProps | Standard React Native View properties, including style, testID, etc. |
|
|
263
|
+
| index | (number) The position of the component in the order sequence. |
|
|
264
|
+
| ref: focus | Reference to a focus command, used to set accessibility focus programmatically. |
|
|
265
|
+
| orderType | Specifies the algorithm used for view ordering (see details below). |
|
|
266
|
+
| onScreenReaderSubViewFocused | Triggered when a subview within the component is focused by the screen reader. |
|
|
267
|
+
| onScreenReaderSubViewBlurred | Triggered when the screen reader focus moves away or is blurred from a subview. |
|
|
268
|
+
| onScreenReaderSubViewFocusChange | Triggered when the focus status of a subview changes (either focused or blurred). |
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
| Value | Description |
|
|
272
|
+
| :-- | :-- |
|
|
273
|
+
| 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. |
|
|
274
|
+
| legacy | Uses the previous implementation for element search, selecting the first child as the accessibility element for ordering. |
|
|
275
|
+
| search | Searches the child tree for the first accessible element to use in the order. |
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
A11y.Order Props:
|
|
279
|
+
|
|
280
|
+
| Prop | Description |
|
|
281
|
+
| :-- | :-- |
|
|
282
|
+
| ...ViewProps | Standard React Native View props, including style, testID, etc. |
|
|
118
283
|
|
|
119
284
|
## A11y.Container
|
|
120
285
|
| View | A11y.Container |
|
|
@@ -127,6 +292,107 @@ The `A11y.Container` component for configuration `UIAccessibilityContainerType`
|
|
|
127
292
|
| ViewProps | Default view props, including style, testID, etc. |
|
|
128
293
|
| type?: | `none` \| `table` \| `list` \| `landmark` \| `group` — representation of `UIAccessibilityContainerType`. The default value is `group`. |
|
|
129
294
|
|
|
295
|
+
|
|
296
|
+
## A11y.View
|
|
297
|
+
`The A11y.View` component can be used to handle and track screen reader focus independently of the `A11y.Index` component.
|
|
298
|
+
|
|
299
|
+
| Prop | Description |
|
|
300
|
+
| :-- | :-- |
|
|
301
|
+
| onScreenReaderFocused | Triggered when the view gets focus from the screen reader. |
|
|
302
|
+
| onScreenReaderSubViewFocused | Triggered when a subview within the component is focused by the screen reader. |
|
|
303
|
+
| onScreenReaderSubViewBlurred | Triggered when the screen reader focus moves away or is blurred from a subview. |
|
|
304
|
+
| onScreenReaderSubViewFocusChange | Triggered when the focus status of a subview changes (either focused or blurred). |
|
|
305
|
+
| 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 } >. |
|
|
306
|
+
|
|
307
|
+
```tsx
|
|
308
|
+
<A11y.View
|
|
309
|
+
onScreenReaderDescendantFocusChanged={(e) => console.log(e)}
|
|
310
|
+
onScreenReaderSubViewFocused={() => console.log('List has been focused')}
|
|
311
|
+
onScreenReaderSubViewBlurred={() => console.log('List has been blurred')}
|
|
312
|
+
onScreenReaderFocused={() => console.log('Focused')}
|
|
313
|
+
>
|
|
314
|
+
...
|
|
315
|
+
</A11y.View>
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
## A11y.FocusFrame, A11y.FocusTrap
|
|
319
|
+
|
|
320
|
+
These components enhance accessibility by providing better control over focus management within specific areas of the screen.
|
|
321
|
+
|
|
322
|
+
- `A11y.FocusFrame`: Used at the root level of a "screen" to detect and prevent focus leaks, ensuring focus remains contained.
|
|
323
|
+
- `A11y.FocusTrap`: Wraps the content area to explicitly enforce focus confinement within a defined region.
|
|
324
|
+
|
|
325
|
+
| Prop | Description |
|
|
326
|
+
| :-- | :-- |
|
|
327
|
+
| ViewProps | Includes all standard React Native View properties, such as style, testID, etc. |
|
|
328
|
+
|
|
329
|
+
```tsx
|
|
330
|
+
<A11y.FocusFrame>
|
|
331
|
+
...
|
|
332
|
+
<A11y.FocusTrap>
|
|
333
|
+
<Text accessibilityRole="header">Locked Area</Text>
|
|
334
|
+
<Button
|
|
335
|
+
title="Confirm"
|
|
336
|
+
accessibilityLabel="Confirm action"
|
|
337
|
+
/>
|
|
338
|
+
</A11y.FocusTrap>
|
|
339
|
+
...
|
|
340
|
+
</A11y.FocusFrame>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## A11y.PaneTitle, A11y.ScreenChange
|
|
344
|
+
|
|
345
|
+
Components for screen change announcements
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
React Native currently lacks built-in APIs for announcing modal or screen transitions. To enhance accessibility, you can use A11y.PaneTitle or A11y.ScreenChange:
|
|
349
|
+
- Screen transitions: Announce navigation to a new screen (e.g., "Login Screen").
|
|
350
|
+
- Modal presentations: Announce when a modal appears (e.g., "Confirm Modal").
|
|
351
|
+
|
|
352
|
+
| Prop | Description |
|
|
353
|
+
| :-- | :-- |
|
|
354
|
+
| title | The title message to be announced for the screen or modal. |
|
|
355
|
+
| detachMessage | The message to be announced when this component is detached (e.g., when leaving the screen). |
|
|
356
|
+
| type | The type of announcement for Android. Options: activity, pane, or announce. |
|
|
357
|
+
| displayed | A trigger for screen focus changes, used to properly update the Android Activity title when switching screens. |
|
|
358
|
+
| withFocusRestore | Ensures that the screen reader focus is preserved and restored appropriately after a screen change. (iOS-specific) |
|
|
359
|
+
|
|
360
|
+
The `A11y.ScreenChange` component is a simplified version of `A11y.PaneTitle`. It is preconfigured with `type="activity"` to handle screen change announcements on Android. Beyond that, it behaves identically to `A11y.PaneTitle`.
|
|
361
|
+
|
|
362
|
+
Example:
|
|
363
|
+
```tsx
|
|
364
|
+
export const LoginScreen = ({ navigation }) => {
|
|
365
|
+
const isFocused = useIsFocused();
|
|
366
|
+
return (
|
|
367
|
+
<View>
|
|
368
|
+
<A11y.ScreenChange
|
|
369
|
+
title="Login Screen"
|
|
370
|
+
displayed={isFocused}
|
|
371
|
+
/>
|
|
372
|
+
<View style={styles.container}>
|
|
373
|
+
<Text>Welcome to the Login Screen</Text>
|
|
374
|
+
<Button title="Continue" onPress={() => navigation.navigate('Home')} />
|
|
375
|
+
</View>
|
|
376
|
+
</View>
|
|
377
|
+
);
|
|
378
|
+
};
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## A11yModule
|
|
382
|
+
`A11yModule` provides an alternative solution for reliably announcing information on iOS.
|
|
383
|
+
|
|
384
|
+
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.
|
|
385
|
+
|
|
386
|
+
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.
|
|
387
|
+
|
|
388
|
+
| Function | Description |
|
|
389
|
+
| :-- | :-- |
|
|
390
|
+
| announce(message: string): void | Posts a message to be announced by the screen reader with improved reliability on iOS. |
|
|
391
|
+
|
|
392
|
+
```tsx
|
|
393
|
+
A11yModule.announce('This is a custom announcement, now more reliable on iOS!');
|
|
394
|
+
```
|
|
395
|
+
|
|
130
396
|
## Migration
|
|
131
397
|
|
|
132
398
|
<details>
|
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
package com.a11yorder;
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
import com.a11yorder.
|
|
4
|
+
import com.a11yorder.modules.A11yAnnounceModule;
|
|
5
|
+
import com.a11yorder.views.A11yUIContainerView.A11yUIContainerViewManager;
|
|
5
6
|
import com.a11yorder.views.A11yGroupView.A11yGroupViewManager;
|
|
6
7
|
import com.a11yorder.views.A11yIndexView.A11yIndexViewManager;
|
|
8
|
+
import com.a11yorder.views.A11yLockView.A11yLockViewManager;
|
|
7
9
|
import com.a11yorder.views.A11yOrderView.A11yOrderViewManager;
|
|
8
10
|
import com.a11yorder.views.A11yPaneTitle.A11yPaneTitleManager;
|
|
9
11
|
import com.a11yorder.views.A11yView.A11yViewManager;
|
|
12
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
13
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
10
14
|
import com.facebook.react.uimanager.ViewManager;
|
|
15
|
+
import com.facebook.react.TurboReactPackage;
|
|
11
16
|
|
|
12
17
|
import java.util.ArrayList;
|
|
18
|
+
import java.util.HashMap;
|
|
13
19
|
import java.util.List;
|
|
20
|
+
import java.util.Map;
|
|
14
21
|
|
|
15
|
-
import com.facebook.react.ReactPackage;
|
|
16
22
|
import com.facebook.react.bridge.NativeModule;
|
|
17
23
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
24
|
|
|
19
|
-
public class A11yOrderPackage
|
|
25
|
+
public class A11yOrderPackage extends TurboReactPackage {
|
|
20
26
|
|
|
21
27
|
@Override
|
|
22
28
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
@@ -24,15 +30,41 @@ public class A11yOrderPackage implements ReactPackage {
|
|
|
24
30
|
viewManagers.add(new A11yIndexViewManager());
|
|
25
31
|
viewManagers.add(new A11yOrderViewManager());
|
|
26
32
|
viewManagers.add(new A11yGroupViewManager());
|
|
27
|
-
viewManagers.add(new
|
|
33
|
+
viewManagers.add(new A11yUIContainerViewManager());
|
|
28
34
|
viewManagers.add(new A11yPaneTitleManager());
|
|
29
35
|
viewManagers.add(new A11yViewManager());
|
|
36
|
+
viewManagers.add(new A11yLockViewManager());
|
|
30
37
|
|
|
31
38
|
return viewManagers;
|
|
32
39
|
}
|
|
33
40
|
|
|
34
41
|
@Override
|
|
35
|
-
public
|
|
36
|
-
|
|
42
|
+
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
43
|
+
if (name.equals(A11yAnnounceModule.NAME)) {
|
|
44
|
+
return new A11yAnnounceModule(reactContext);
|
|
45
|
+
} else {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Override
|
|
51
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
52
|
+
return new ReactModuleInfoProvider() {
|
|
53
|
+
@Override
|
|
54
|
+
public Map<String, ReactModuleInfo> getReactModuleInfos() {
|
|
55
|
+
Map<String, ReactModuleInfo> map = new HashMap<>();
|
|
56
|
+
boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
57
|
+
|
|
58
|
+
map.put(A11yAnnounceModule.NAME, new ReactModuleInfo(
|
|
59
|
+
A11yAnnounceModule.NAME, // name
|
|
60
|
+
A11yAnnounceModule.NAME, // className
|
|
61
|
+
false, // canOverrideExistingModule
|
|
62
|
+
false, // needsEagerInit
|
|
63
|
+
false, // isCXXModule
|
|
64
|
+
isTurboModule // isTurboModule
|
|
65
|
+
));
|
|
66
|
+
return map;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
37
69
|
}
|
|
38
70
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
package com.a11yorder.core;
|
|
2
|
+
|
|
3
|
+
import android.content.Context;
|
|
4
|
+
import android.view.View;
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.views.view.ReactViewGroup;
|
|
7
|
+
|
|
8
|
+
import java.lang.ref.WeakReference;
|
|
9
|
+
|
|
10
|
+
public class A11yViewGroup extends ReactViewGroup {
|
|
11
|
+
private WeakReference<View> childRef;
|
|
12
|
+
|
|
13
|
+
public A11yViewGroup(Context context) {
|
|
14
|
+
super(context);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
protected void onChildAttached(View child) {}
|
|
18
|
+
protected void onChildRemoved() {}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
protected View getSubChild() {
|
|
22
|
+
return childRef != null ? childRef.get() : null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected void onSubChildChange(View child) {
|
|
26
|
+
if (child != null) {
|
|
27
|
+
onChildAttached(child);
|
|
28
|
+
} else {
|
|
29
|
+
onChildRemoved();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private void setSubChild(View child) {
|
|
34
|
+
if (child != null) {
|
|
35
|
+
childRef = new WeakReference<>(child);
|
|
36
|
+
} else if (childRef != null) {
|
|
37
|
+
childRef.clear();
|
|
38
|
+
childRef = null;
|
|
39
|
+
}
|
|
40
|
+
onSubChildChange(child);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
public void onViewAdded(View child) {
|
|
45
|
+
super.onViewAdded(child);
|
|
46
|
+
if (getSubChild() == null) {
|
|
47
|
+
setSubChild(child);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Override
|
|
52
|
+
public void onViewRemoved(View child) {
|
|
53
|
+
super.onViewRemoved(child);
|
|
54
|
+
if (getSubChild() == child) {
|
|
55
|
+
setSubChild(null);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@Override
|
|
60
|
+
protected void onAttachedToWindow() {
|
|
61
|
+
super.onAttachedToWindow();
|
|
62
|
+
|
|
63
|
+
if (getSubChild() == null && getChildCount() > 0) {
|
|
64
|
+
setSubChild(getChildAt(0));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@Override
|
|
69
|
+
protected void onDetachedFromWindow() {
|
|
70
|
+
super.onDetachedFromWindow();
|
|
71
|
+
setSubChild(null);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
package com.a11yorder.events;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.ReactContext;
|
|
4
|
+
import com.facebook.react.uimanager.UIManagerHelper;
|
|
5
|
+
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
6
|
+
import com.facebook.react.uimanager.events.Event;
|
|
7
|
+
|
|
8
|
+
import java.util.HashMap;
|
|
9
|
+
import java.util.Map;
|
|
10
|
+
|
|
11
|
+
public class EventHelper {
|
|
12
|
+
private static <T extends Event<T>> void dispatchEventIfPossible(ReactContext context, int id, T event) {
|
|
13
|
+
EventDispatcher eventDispatcher = UIManagerHelper.getEventDispatcherForReactTag(context, id);
|
|
14
|
+
if (eventDispatcher != null) {
|
|
15
|
+
eventDispatcher.dispatchEvent(event);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public static void screenReaderFocusChanged(ReactContext context, int id, boolean hasFocus) {
|
|
20
|
+
int surfaceId = UIManagerHelper.getSurfaceId(context);
|
|
21
|
+
ScreenReaderFocusChangedEvent event = new ScreenReaderFocusChangedEvent(surfaceId, id, hasFocus);
|
|
22
|
+
dispatchEventIfPossible(context, id, event);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static void screenReaderFocused(ReactContext context, int id) {
|
|
26
|
+
int surfaceId = UIManagerHelper.getSurfaceId(context);
|
|
27
|
+
ScreenReaderFocusedEvent event = new ScreenReaderFocusedEvent(surfaceId, id);
|
|
28
|
+
dispatchEventIfPossible(context, id, event);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public static void screenReaderDescendantFocusChanged(ReactContext context, int id, String status, String nativeId) {
|
|
32
|
+
int surfaceId = UIManagerHelper.getSurfaceId(context);
|
|
33
|
+
ScreenReaderDescendantFocusChangedEvent event = new ScreenReaderDescendantFocusChangedEvent(surfaceId, id, status, nativeId);
|
|
34
|
+
dispatchEventIfPossible(context, id, event);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public static Map<String, Object> buildDirectEventMap(String registrationName) {
|
|
38
|
+
Map<String, Object> eventMap = new HashMap<>();
|
|
39
|
+
eventMap.put("registrationName", registrationName);
|
|
40
|
+
return eventMap;
|
|
41
|
+
}
|
|
42
|
+
}
|
package/android/src/main/java/com/a11yorder/events/ScreenReaderDescendantFocusChangedEvent.java
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package com.a11yorder.events;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments;
|
|
4
|
+
import com.facebook.react.bridge.WritableMap;
|
|
5
|
+
import com.facebook.react.uimanager.events.Event;
|
|
6
|
+
|
|
7
|
+
public class ScreenReaderDescendantFocusChangedEvent extends Event<ScreenReaderDescendantFocusChangedEvent> {
|
|
8
|
+
public static String EVENT_NAME = "topScreenReaderDescendantFocusChanged";
|
|
9
|
+
public WritableMap payload;
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
public ScreenReaderDescendantFocusChangedEvent(int surfaceId, int id, String status, String nativeId) {
|
|
13
|
+
super(surfaceId, id);
|
|
14
|
+
payload = Arguments.createMap();
|
|
15
|
+
payload.putString("status", status);
|
|
16
|
+
payload.putString("nativeId", nativeId);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public boolean canCoalesce() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Override
|
|
24
|
+
public String getEventName() {
|
|
25
|
+
return EVENT_NAME;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@Override
|
|
29
|
+
public WritableMap getEventData() {
|
|
30
|
+
return payload;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
package com.a11yorder.events;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.Arguments;
|
|
4
|
+
import com.facebook.react.bridge.WritableMap;
|
|
5
|
+
import com.facebook.react.uimanager.events.Event;
|
|
6
|
+
|
|
7
|
+
public class ScreenReaderFocusChangedEvent extends Event<ScreenReaderFocusChangedEvent> {
|
|
8
|
+
public static String EVENT_NAME = "topScreenReaderFocusChange";
|
|
9
|
+
public WritableMap payload;
|
|
10
|
+
|
|
11
|
+
public ScreenReaderFocusChangedEvent(int surfaceId, int id, Boolean hasFocus) {
|
|
12
|
+
super(surfaceId, id);
|
|
13
|
+
payload = Arguments.createMap();
|
|
14
|
+
payload.putBoolean("isFocused", hasFocus);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@Override
|
|
18
|
+
public String getEventName() {
|
|
19
|
+
return EVENT_NAME;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Override
|
|
23
|
+
public WritableMap getEventData() {
|
|
24
|
+
return payload;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
package com.a11yorder.events;
|
|
2
|
+
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
import com.facebook.react.uimanager.events.Event;
|
|
5
|
+
|
|
6
|
+
public class ScreenReaderFocusedEvent extends Event<ScreenReaderFocusedEvent> {
|
|
7
|
+
public static String EVENT_NAME = "topScreenReaderFocused";
|
|
8
|
+
public WritableMap payload;
|
|
9
|
+
|
|
10
|
+
public ScreenReaderFocusedEvent(int surfaceId, int id) {
|
|
11
|
+
super(surfaceId, id);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Override
|
|
15
|
+
public String getEventName() {
|
|
16
|
+
return EVENT_NAME;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Override
|
|
20
|
+
public WritableMap getEventData() {
|
|
21
|
+
return payload;
|
|
22
|
+
}
|
|
23
|
+
}
|