Skip to content

Commit cf918b6

Browse files
Merge pull request #32790 from DylanDylann/fix/32080-copy-referral-link-is-not-actived
Fix/32080: Referral button is not focused
2 parents 298d9d2 + 1e3d9bc commit cf918b6

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

src/components/CopyTextToClipboard.js

+3
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ const propTypes = {
1313
// eslint-disable-next-line react/forbid-prop-types
1414
textStyles: PropTypes.arrayOf(PropTypes.object),
1515
urlToCopy: PropTypes.string,
16+
accessibilityRole: PropTypes.string,
1617
...withLocalizePropTypes,
1718
};
1819

1920
const defaultProps = {
2021
textStyles: [],
2122
urlToCopy: null,
23+
accessibilityRole: undefined,
2224
};
2325

2426
function CopyTextToClipboard(props) {
@@ -34,6 +36,7 @@ function CopyTextToClipboard(props) {
3436
icon={Expensicons.Copy}
3537
textStyles={props.textStyles}
3638
onPress={copyToClipboard}
39+
accessibilityRole={props.accessibilityRole}
3740
/>
3841
);
3942
}

src/components/Pressable/PressableWithDelayToggle.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type PressableWithDelayToggleProps = PressableProps & {
4848
* vertical text alignment of non-Text elements
4949
*/
5050
inline?: boolean;
51+
accessibilityRole?: string;
5152
};
5253

5354
function PressableWithDelayToggle(
@@ -63,6 +64,7 @@ function PressableWithDelayToggle(
6364
textStyles,
6465
iconStyles,
6566
icon,
67+
accessibilityRole,
6668
}: PressableWithDelayToggleProps,
6769
ref: PressableRef,
6870
) {
@@ -101,6 +103,7 @@ function PressableWithDelayToggle(
101103
onPress={updatePressState}
102104
accessibilityLabel={tooltipTexts}
103105
suppressHighlighting={inline ? true : undefined}
106+
accessibilityRole={accessibilityRole}
104107
>
105108
<>
106109
{inline && labelText}

src/pages/ReferralDetailsPage.js

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ function ReferralDetailsPage({route, account}) {
9090
{shouldShowClipboard && (
9191
<View style={[styles.border, styles.pv2, styles.ph3, styles.mb6]}>
9292
<CopyTextToClipboard
93+
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
9394
text={translate('referralProgram.copyReferralLink')}
9495
textStyles={[styles.colorMuted]}
9596
urlToCopy={generateReferralURL(account.primaryLogin)}

0 commit comments

Comments
 (0)