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

setDefaultOptions backButton testID and accessibilityLabel do not work as expected

Open robrechtme opened this issue 4 years ago • 3 comments

🐛 Bug Report

Passing a testID or accessibilityLabel through defaultOptions does not work as expected. This duplicates https://github.com/wix/react-native-navigation/issues/6669, but hopefully provides more info. If you want, I can look into submitting a PR.

To Reproduce

Navigation.setDefaultOptions({
  backButton: {
    icon: require('../assets/images/arrowBack.png'),
    testID: 'customTestID',
    accessibilityLabel: 'customA11yLabel',
  },
});

Expected behavior

The custom testID and/or accessibilityLabel show up in Appium. According to the docs, accessibilityLabel is only supported on Android, but testID should work on both platforms.

Actual Behavior

  • On iOS, the accessibilityLabel and testID will both be the title of the previous screen (unless there is no title, then it is 'Back').
  • On Android, the accessibilityLabel and testID are set to 'Navigate Up'. This makes it very difficult to use it in e2e tests.

Screenshot 2021-03-12 at 13 41 46

A custom testID on a button in topBar.leftButtons or topBar.rightButtons however does show up in Appium.

Your Environment

  • React Native Navigation version: 7.11.3
  • React Native version: 0.63.4
  • Platform(s) (iOS, Android, or both?): Both
  • Device info (Simulator/Device? OS version? Debug/Release?): Pixel 3a (Android 11) / iPhone 12 Mini sim (iOS 14.4)

robrechtme avatar Mar 12 '21 12:03 robrechtme

Issue with accessibilityLabel fixed on Android and

Issue with testID on Android fixed in https://github.com/wix/react-native-navigation/pull/7298 (PR in review)

retyui avatar Oct 06 '21 18:10 retyui

Nice! This is fixed on Android now. On iOS we still cannot configure the a11yLabel or testID. They will always be set to the title of the previous screen (unless there is no title, then it is 'Back').

robrechtme avatar Dec 16 '21 07:12 robrechtme

On iOS we still cannot configure the a11yLabel or testID. They will always be set to the title of the previous screen (unless there is no title, then it is 'Back').

Is there any update on this issue? We are still experiencing this on iOS.

VNDRN avatar Feb 03 '22 08:02 VNDRN