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

Incorrect accessibilityRole on Switch component #26873

Closed
lewie9021 opened this issue Oct 16, 2019 · 4 comments
Closed

Incorrect accessibilityRole on Switch component #26873

lewie9021 opened this issue Oct 16, 2019 · 4 comments
Labels
Bug Component: Switch Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@lewie9021
Copy link

lewie9021 commented Oct 16, 2019

It appears the Switch component in iOS has an accessibilityRole prop of "button" instead of "switch". This became apparent when testing with Appium.

import React from "react";
import { Switch } from "react-native";

function SwitchExample() {
  return (
    <Switch
      testID="switch"
      value={true}
    />
  );
}

Screenshot 2019-10-16 at 08 05 17

React Native version:

System:
    OS: macOS Mojave 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 118.87 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
    Yarn: 1.19.1 - ~/.yarn/bin/yarn
    npm: 6.10.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
    Android SDK:
      API Levels: 25, 26, 27, 28
      Build Tools: 27.0.3, 28.0.3
      System Images: android-27 | Intel x86 Atom_64, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
  IDEs:
    Android Studio: 3.2 AI-181.5540.7.32.5056338
    Xcode: 10.3/10G8 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.1 => 16.8.1 
    react-native: 0.61.2 => 0.61.2

Steps To Reproduce

  1. Run the example above.
  2. Notice the wrong type (XCUIElementTypeButton) in Appium Desktop
  3. Override accessibilityRole with "switch".
  4. Notice the type is now correct (XCUIElementTypeSwitch) in Appium Desktop.

Below is a screenshot of the expected result:
Screenshot 2019-10-16 at 08 06 05

I did some investigation myself and it looks like this line and this line are the issue.

@lewie9021 lewie9021 added the Bug label Oct 16, 2019
facebook-github-bot pushed a commit that referenced this issue Oct 19, 2019
Summary:
`accessibilityRole` communicates the purpose of a component to the user of assistive technology. It needs to have the correct value for it to be fully utilized.

Switch component has `accessibilityRole` of a `button` instead of `switch` on default. Change the component default role to `switch`.

## Changelog

[General] [Fixed] - Change default `accessibilityRole` of Switch component from `button` to `switch`
Pull Request resolved: #26899

Test Plan:
- All unit test passed
- On Switch component, it's supposed to have `switch` like element type on both platform. (`XCUIElementTypeSwitch` on iOS)

fix [#26873

Reviewed By: yungsters

Differential Revision: D18002755

Pulled By: mdvacca

fbshipit-source-id: 60446f94b23f8355f954805fb4dc08c89d08e492
@stale
Copy link

stale bot commented Jan 15, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 15, 2020
@lewie9021
Copy link
Author

Not fixed. Still "button" in 0.61.5.

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 15, 2020
@stale
Copy link

stale bot commented Apr 14, 2020

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Apr 14, 2020
@stale
Copy link

stale bot commented Apr 21, 2020

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Apr 21, 2020
@facebook facebook locked as resolved and limited conversation to collaborators Apr 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: Switch Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants