Skip to content

Commit bbd6aa3

Browse files
authored
Merge pull request Expensify#80446 from linhvovan29546/fix/77460-send-button-not-work-when-enable-talkback
Can't send message on Android when Talkback is enabled
2 parents 735721f + a2a4ad5 commit bbd6aa3

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/pages/inbox/report/ReportActionCompose/SendButton.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,24 @@ function SendButton({isDisabled: isDisabledProp, handleSendMessage}: SendButtonP
4444
key={`send-button-${isSmallScreenWidth ? 'small-screen' : 'normal-screen'}`}
4545
gesture={Tap}
4646
>
47-
<View collapsable={false}>
47+
<View
48+
// In order to make buttons accessible, we have to wrap children in a View with accessible and accessibilityRole="button" props based on the docs: https://docs.swmansion.com/react-native-gesture-handler/docs/components/buttons/
49+
accessible
50+
role={CONST.ROLE.BUTTON}
51+
accessibilityLabel={translate('common.send')}
52+
collapsable={false}
53+
>
4854
<Tooltip text={translate('common.send')}>
4955
<PressableWithFeedback
5056
style={({pressed, isDisabled}) => [
5157
styles.chatItemSubmitButton,
5258
isDisabledProp || pressed || isDisabled ? undefined : styles.buttonSuccess,
5359
isDisabledProp ? styles.cursorDisabled : undefined,
5460
]}
55-
role={CONST.ROLE.BUTTON}
56-
accessibilityLabel={translate('common.send')}
61+
// Since the parent View has accessible, we need to set accessible to false here to avoid duplicate accessibility elements.
62+
// On Android when TalkBack is enabled, only the parent element should be accessible, otherwise the button will not work.
63+
accessible={false}
64+
focusable={false}
5765
sentryLabel={CONST.SENTRY_LABEL.REPORT.SEND_BUTTON}
5866
>
5967
{({pressed}) => (

0 commit comments

Comments
 (0)