Skip to content

Commit

Permalink
Switch: Improve Accessibility
Browse files Browse the repository at this point in the history
Summary: On Android, `Switch` does not currently read its role as a "button". This fixes that and makes it consistent with iOS.

Reviewed By: sahrens

Differential Revision: D13136253

fbshipit-source-id: 0de5d54772d204168138cb2af7815cc458f72682
  • Loading branch information
yungsters authored and facebook-github-bot committed Nov 27, 2018
1 parent 2ae559a commit 0c8db08
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/Components/Switch/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class Switch extends React.Component<Props> {
<SwitchNativeComponent
{...props}
{...platformProps}
accessibilityRole={props.accessibilityRole ?? 'button'}
onChange={this._handleChange}
onResponderTerminationRequest={returnsFalse}
onStartShouldSetResponder={returnsTrue}
Expand Down

0 comments on commit 0c8db08

Please sign in to comment.