diff --git a/src/CONST.ts b/src/CONST.ts index b31bcc424c84..447c519dfcf9 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -3758,69 +3758,6 @@ const CONST = { EXPENSIFY_LOGO_SIZE_RATIO: 0.22, EXPENSIFY_LOGO_MARGIN_RATIO: 0.03, }, - /** - * Acceptable values for the `accessibilityRole` prop on react native components. - * - * **IMPORTANT:** Do not use with the `role` prop as it can cause errors. - * - * @deprecated ACCESSIBILITY_ROLE is deprecated. Please use CONST.ROLE instead. - */ - ACCESSIBILITY_ROLE: { - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - BUTTON: 'button', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - LINK: 'link', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - MENUITEM: 'menuitem', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - TEXT: 'text', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - RADIO: 'radio', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - IMAGEBUTTON: 'imagebutton', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - CHECKBOX: 'checkbox', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - SWITCH: 'switch', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - ADJUSTABLE: 'adjustable', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - IMAGE: 'image', - - /** - * @deprecated Please stop using the accessibilityRole prop and use the role prop instead. - */ - TEXTBOX: 'textbox', - }, /** * Acceptable values for the `role` attribute on react native components. * diff --git a/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx b/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx index a9b5dfb7feb6..453b7b4fd106 100644 --- a/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx +++ b/src/components/Attachments/AttachmentCarousel/CarouselItem.tsx @@ -58,7 +58,7 @@ function CarouselItem({item, onPress, isFocused, isModalHovered}: CarouselItemPr diff --git a/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx b/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx index c195c1e34554..0ec2bb5ef0b5 100644 --- a/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx +++ b/src/components/Attachments/AttachmentView/AttachmentViewImage/index.tsx @@ -34,7 +34,7 @@ function AttachmentViewImage({url, file, isAuthTokenRequired, loadComplete, onPr onPress={onPress} disabled={loadComplete} style={[styles.flex1, styles.flexRow, styles.alignSelfStretch]} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing accessibilityLabel={file?.name || translate('attachmentView.unknownFilename')} > diff --git a/src/components/AvatarWithImagePicker.tsx b/src/components/AvatarWithImagePicker.tsx index a1b8524dd293..337bbaf98ca1 100644 --- a/src/components/AvatarWithImagePicker.tsx +++ b/src/components/AvatarWithImagePicker.tsx @@ -368,7 +368,7 @@ function AvatarWithImagePicker({ > onPressAvatar(openPicker)} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={translate('avatarWithImagePicker.editImage')} disabled={isAvatarCropModalOpen || (disabled && !enablePreview)} disabledStyle={disabledStyle} diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx index 1441266c76de..72746aa1f65d 100644 --- a/src/components/Button/index.tsx +++ b/src/components/Button/index.tsx @@ -137,13 +137,13 @@ type ButtonProps = Partial & { type KeyboardShortcutComponentProps = Pick; -const accessibilityRoles: string[] = Object.values(CONST.ACCESSIBILITY_ROLE); +const accessibilityRoles: string[] = Object.values(CONST.ROLE); function KeyboardShortcutComponent({isDisabled = false, isLoading = false, onPress = () => {}, pressOnEnter, allowBubble, enterKeyEventListenerPriority}: KeyboardShortcutComponentProps) { const isFocused = useIsFocused(); const activeElementRole = useActiveElementRole(); - const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ACCESSIBILITY_ROLE.TEXT, [activeElementRole]); + const shouldDisableEnterShortcut = useMemo(() => accessibilityRoles.includes(activeElementRole ?? '') && activeElementRole !== CONST.ROLE.PRESENTATION, [activeElementRole]); const keyboardShortcutCallback = useCallback( (event?: GestureResponderEvent | KeyboardEvent) => { diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx index 1e73cce1630f..aedd0747fd7a 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/ImageRenderer.tsx @@ -97,7 +97,7 @@ function ImageRenderer({tnode}: ImageRendererProps) { showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs)) } shouldUseHapticsOnLongPress - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={translate('accessibilityHints.viewAttachment')} > {thumbnailImageComponent} diff --git a/src/components/PDFView/index.native.tsx b/src/components/PDFView/index.native.tsx index 55f85aa74b37..44ef894cb994 100644 --- a/src/components/PDFView/index.native.tsx +++ b/src/components/PDFView/index.native.tsx @@ -172,7 +172,7 @@ function PDFView({onToggleKeyboard, onLoadComplete, fileName, onPress, isFocused onPress={onPress} fullDisabled={successToLoadPDF} style={[themeStyles.flex1, themeStyles.alignSelfStretch, !failedToLoadPDF && themeStyles.flexRow]} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing accessibilityLabel={fileName || translate('attachmentView.unknownFilename')} > diff --git a/src/components/PDFView/index.tsx b/src/components/PDFView/index.tsx index 2edf699affab..69d886dc7c37 100644 --- a/src/components/PDFView/index.tsx +++ b/src/components/PDFView/index.tsx @@ -131,7 +131,7 @@ function PDFView({onToggleKeyboard, fileName, onPress, isFocused, sourceURL, max diff --git a/src/components/ReferralProgramCTA.tsx b/src/components/ReferralProgramCTA.tsx index 086b875451c0..808df9c4d94d 100644 --- a/src/components/ReferralProgramCTA.tsx +++ b/src/components/ReferralProgramCTA.tsx @@ -54,7 +54,7 @@ function ReferralProgramCTA({referralContentType, style, onDismiss}: ReferralPro }} style={[styles.br2, styles.highlightBG, styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter, {gap: 10, padding: 10}, styles.pl5, style]} accessibilityLabel="referral" - role={CONST.ACCESSIBILITY_ROLE.BUTTON} + role={CONST.ROLE.BUTTON} > {translate(`referralProgram.${referralContentType}.buttonText1`)} @@ -72,7 +72,7 @@ function ReferralProgramCTA({referralContentType, style, onDismiss}: ReferralPro e.preventDefault(); }} style={[styles.touchableButtonImage]} - role={CONST.ACCESSIBILITY_ROLE.BUTTON} + role={CONST.ROLE.BUTTON} accessibilityLabel={translate('common.close')} > navigateToAvatarPage(icons[0])} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={icons[0].name ?? ''} disabled={icons[0].source === Expensicons.FallbackAvatar} > @@ -77,7 +77,7 @@ function RoomHeaderAvatars({icons, reportID}: RoomHeaderAvatarsProps) { navigateToAvatarPage(icon)} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} accessibilityLabel={icon.name ?? ''} disabled={icon.source === Expensicons.FallbackAvatar} > diff --git a/src/components/TextLink.tsx b/src/components/TextLink.tsx index b6ffb14753c1..2d390f9811e6 100644 --- a/src/components/TextLink.tsx +++ b/src/components/TextLink.tsx @@ -62,7 +62,7 @@ function TextLink({href, onPress, children, style, onMouseDown = (event) => even return ( DeviceCapabilities.canUseTouchScreen() && ControlSelection.block()} onPressOut={() => ControlSelection.unblock()} diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 805fd90ab369..77611e269928 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -255,8 +255,8 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { toggleOption(item)} disabled={item.isDisabled} - role={CONST.ACCESSIBILITY_ROLE.CHECKBOX} - accessibilityLabel={CONST.ACCESSIBILITY_ROLE.CHECKBOX} + role={CONST.ROLE.BUTTON} + accessibilityLabel={CONST.ROLE.BUTTON} style={[styles.flexRow, styles.alignItemsCenter, styles.ml3]} > diff --git a/src/pages/ProfilePage.tsx b/src/pages/ProfilePage.tsx index d172e2089983..8b12ae4b63ab 100755 --- a/src/pages/ProfilePage.tsx +++ b/src/pages/ProfilePage.tsx @@ -197,7 +197,7 @@ function ProfilePage({route}: ProfilePageProps) { style={[styles.noOutline, styles.mb4]} onPress={() => Navigation.navigate(ROUTES.PROFILE_AVATAR.getRoute(String(accountID)))} accessibilityLabel={translate('common.profile')} - accessibilityRole={CONST.ACCESSIBILITY_ROLE.IMAGEBUTTON} + accessibilityRole={CONST.ROLE.BUTTON} disabled={!hasAvatar} > diff --git a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx index 528b3ab1e88f..9c24e92689cc 100644 --- a/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx +++ b/src/pages/iou/request/step/IOURequestStepScan/index.native.tsx @@ -552,7 +552,7 @@ function IOURequestStepScan({ {({openPicker}) => ( { @@ -571,7 +571,7 @@ function IOURequestStepScan({ )} {hasFlash && ( ( { openPicker({ onPicked: setReceiptAndNavigate, @@ -619,7 +619,7 @@ function IOURequestStepScan({ )}