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: add accessibilityLabel prop to MenuItem #2577

Merged
merged 5 commits into from
Apr 9, 2021
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/Menu/MenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ type Props = {
* TestID used for testing purposes
*/
testID?: string;
/**
* Accessibility label for the Touchable. This is read by the screen reader when the user taps the component.
*/
accessibilityLabel?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a description above this prop? Something like:

/**
 * Accessibility label for the Touchable. This is read by the screen reader when the user taps the component.
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

};

/**
Expand Down Expand Up @@ -86,6 +90,7 @@ class MenuItem extends React.Component<Props> {
contentStyle,
testID,
titleStyle,
accessibilityLabel,
} = this.props;

const disabledColor = color(theme.dark ? white : black)
Expand All @@ -107,6 +112,7 @@ class MenuItem extends React.Component<Props> {
onPress={onPress}
disabled={disabled}
testID={testID}
accessibilityLabel={accessibilityLabel}
accessibilityRole="menuitem"
accessibilityState={{ disabled }}
>
Expand Down