react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Child components of SafeAreaView not detected by accessibility framework

Open kashishgrover opened this issue 3 years ago • 20 comments

The Problem

Child component of a certain SafeAreaView is not being picked up by the Accessibility Inspector, and in turn by Appium.

Appium issue: https://github.com/appium/appium/issues/14602 Similar Stack Overflow issue: https://stackoverflow.com/questions/57820250/safeareaview-doesnt-let-appium-find-accessibility-id-of-children-views-on-react

Details

My use case demands me to to use the SafeAreaView for an animated bottom sheet component which I have implemented. The skeleton code looks somewhat like this:

import React from 'react';
import {
  SafeAreaView,
  View,
  Text,
  StyleSheet,
  TouchableOpacity,
} from 'react-native';

const BottomSheet = (props) => {
  return (
    <SafeAreaView>
      <View style={styles.bottomSheet}>{props.children}</View>
    </SafeAreaView>
  );
};

const App = () => {
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.content}>
        <Text>Some content</Text>
      </View>
      <BottomSheet>
        <TouchableOpacity
          style={styles.button}
          testID="button-test-id" // Not detected
          accessibilityLabel="button-test-id" // Not detected
        >
          <Text>Button</Text>
        </TouchableOpacity>
      </BottomSheet>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  content: {
    backgroundColor: 'orange',
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
    padding: 32,
  },
  bottomSheet: {
    backgroundColor: 'blue',
    position: 'absolute',
    bottom: 0,
    left: 0,
    right: 0,
    paddingVertical: 8,
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
  },
  button: {
    backgroundColor: 'white',
    paddingVertical: 16,
    paddingHorizontal: 32,
    alignItems: 'center',
    borderRadius: 50,
  },
});

export default App;

Screenshots

Accessibility Inspector -- Button not detected when SafeAreaView is present in the BottomSheet

image

Accessibility Inspector -- Button detected when no SafeAreaView in BottomSheet

Screenshot 2020-07-27 at 4 53 47 PM (2)

Appium.app

Screenshot 2020-07-27 at 3 17 20 PM Screenshot 2020-07-27 at 3 17 23 PM

Environment:

System:
    OS: macOS 10.15.5
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 288.34 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.5.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.14.6 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  Languages:
    Java: 13.0.2 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.0 => 0.63.0 
  npmGlobalPackages:
    *react-native*: Not Found

kashishgrover avatar Jul 27 '20 11:07 kashishgrover

hello im facing same issue any news from your side?

JLOUIS3434343443 avatar Aug 18 '20 14:08 JLOUIS3434343443

Hi, I'm facing the same issue! Any news?

JulianOrozcoC avatar Aug 27 '20 16:08 JulianOrozcoC

We've got the same issue

nethergrim avatar Sep 03 '20 10:09 nethergrim

I'm getting this issue too, anyone found a workaround?

AdamBowler avatar Dec 16 '20 16:12 AdamBowler

I''m getting this issue also

bbkillen avatar Jun 18 '21 15:06 bbkillen

I am also getting same issue

sirajtahrawashmen avatar Jun 29 '21 10:06 sirajtahrawashmen

any solution , getting same issue

ashwajeet24 avatar Jul 30 '21 03:07 ashwajeet24

We've got the same issue

WannaBeDream avatar Jan 02 '22 02:01 WannaBeDream

I think its due to the fact the the BottomSheet is positioned absolutely. I have the same problem With react navigation and absolute positioned headers.

JaapWeijland avatar Jan 20 '22 23:01 JaapWeijland

any solution , getting same issue

ijhar-nivoda avatar Jul 27 '22 08:07 ijhar-nivoda

I could reproduce it using the Accessibility Inspector, but not using VoiceOver on a real device. I modified the example below to reproduce your scenario. Thanks

https://www.icloud.com/iclouddrive/058DYalQMfMD_rODqfnGn2owg#testing_voiceover_with_safeareaview

@aliossam

fabOnReact avatar Oct 12 '22 06:10 fabOnReact

any update on this issue? I'm working with a RN app and Appium and cant access anything inside the SafeAreaView.

robergwillian avatar Jan 10 '23 18:01 robergwillian

@fabriziobertoglio1987 have you found any solutions or work around?

AdamBowler avatar Feb 03 '23 18:02 AdamBowler

any updates? having the same issue

anaelmashinsky avatar Feb 15 '23 09:02 anaelmashinsky

I have the same issue with this...I can't get access from anything inside of SafeAreaView

cport93 avatar Feb 15 '23 23:02 cport93

We are experiencing same issue anything inside SafeAreaView is not being picked up by the Accessibility Inspector, this issue is only happening for IOS.

moygoca1 avatar Apr 10 '23 21:04 moygoca1

For me it's not only for iOS but for Android as well. Button and TouchableOpacity are not visible in Appium if wrapped inside SafeAreaView.

andrii-rymar avatar May 03 '23 10:05 andrii-rymar

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 31 '23 05:10 github-actions[bot]

Still experiencing this issue.

diarshabani avatar Nov 06 '23 19:11 diarshabani

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 05 '24 05:05 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar May 12 '24 05:05 github-actions[bot]