react-native-elements/react-native-elements

Add accessibilityHint and accessibilityLabel support to ButtonGroup buttons

Open

#3,196 创建于 2021年9月4日

在 GitHub 查看
 (9 评论) (3 反应) (0 负责人)TypeScript (23,818 star) (4,564 fork)batch import
Good First Issueaccessibilitycomponent: ButtonGroup

描述

Is your feature request related to a problem? Please Describe.

Add accessibilityHint and accessibilityLabel support to ButtonGroup buttons. Currently when I try to pass in a custom button component like this to the ButtonGroup buttons prop:

const buttons = [
  (
    <Text
      accessibilityHint={translate('ARIA HINT - Tap to search by podcast title')}
      accessibilityLabel={translate('Search by podcast title')}>
      {translate('Podcast')}
    </Text>
  ),
  (
    <Text
      accessibilityHint={translate('ARIA HINT - Tap to search by podcast host')}
      accessibilityLabel={translate('Search by podcast title')}>
      {translate('Host')}
    </Text>
  )
]

Neither the accessibilityHint or accessibilityLabel are read. I think it may be because the ButtonGroup buttons are wrapped in their own that we cannot override or configure with props.

Describe the solution you'd like

When accessibilityHint and accessibilityLabel are provided for custom ButtonGroup buttons, they should be read by iOS and Android screen readers. This solution may require optionally overriding the wrapping the ButtonGroup buttons.

Describe alternatives you've considered

I can't think of another way to accomplish the same thing.

贡献者指南