Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Support accessibilityLabel for Switch components #30706

Closed
kj800x opened this issue Jan 8, 2021 · 2 comments
Closed

Feat: Support accessibilityLabel for Switch components #30706

kj800x opened this issue Jan 8, 2021 · 2 comments
Labels

Comments

@kj800x
Copy link

kj800x commented Jan 8, 2021

Description

This is a feature request. <Switch /> components do not support the accessibilityLabel prop.

Motivation: I am using the Appium testing framework as it is the preferred framework for integrating with BrowserStack. Appium highly recommends using accessibilityLabel to identify components, allowing developers to fallback on XPath as a last resort.

React Native version:

I am currently using react-native@0.62.1 but looking at the online docs for <Switch /> I see that the prop is still not supported in latest (0.63).

System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 125.42 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.14.1 - ~/.nvm/versions/node/v12.14.1/bin/node
    Yarn: 1.22.4 - ~/.nvm/versions/node/v12.14.1/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.14.1/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.0 - /Users/kjohnson/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 3.2 AI-181.5540.7.32.5056338
    Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.2 - /usr/bin/javac
    Python: 2.7.17 - /usr/local/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0
    react-native: 0.62.1 => 0.62.1
  npmGlobalPackages:
    *react-native*: Not Found

Steps To Reproduce

  1. Render <Switch accessibilityLabel="test" />
  2. <android.widget.Switch> has no content-desc property. This property should have the same value as the accessibilityLabel prop.

Screen Shot 2021-01-08 at 11 54 07 AM

Expected Results

When viewed in Appium or another app view source explorer, the <android.widget.Switch> node in the rendered tree will have a content-desc="test" (see the ViewGroup for reference). The correct corresponding property will be set on iOS.

Snack, code example, screenshot, or link to a repository:

import React from 'react';
import { Switch, View } from 'react-native';

function App() {
  return <View><Switch accessibilityLabel="test" /></View>
}
@safaiyeh safaiyeh added Accessibility DX Issues concerning how the developer experience can be improved. and removed Needs: Triage 🔍 DX Issues concerning how the developer experience can be improved. labels Jan 9, 2021
@amarlette
Copy link

This issue will most likely be resolved by #30944 as part of the Improved React Native Accessibility Project

@lunaleaps
Copy link
Contributor

Closing this then and tracking in #30944

@facebook facebook locked as resolved and limited conversation to collaborators Apr 29, 2022
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Apr 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants