Skip to content

Commit

Permalink
Add accessibiltyRole to ListItemInfo component (#354)
Browse files Browse the repository at this point in the history
## Short description
This PR introduces the accessibilityRole prop to the ListItemInfo
component, enabling better support for accessibilty when displaying
non-string values.

## List of changes proposed in this pull request
- Added `accessibiltyRole` prop to `ListItemInfo` component

## How to test
1. Set the accessibilityRole prop on a ListItemInfo component.
2. Verify that screen readers correctly interpret the role specified by
the prop, ensuring accessibility is enhanced as expected.
  • Loading branch information
mastro993 committed Nov 12, 2024
1 parent 4d9f97a commit f68f4a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/listitems/ListItemInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import React, { ComponentProps, useCallback, useMemo } from "react";
import { Platform, View } from "react-native";
import { AccessibilityRole, Platform, View } from "react-native";
import {
IOListItemStyles,
IOListItemVisualParams,
IOStyles,
useIOTheme
} from "../../core";
import { WithTestID } from "../../utils/types";
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
import { H6, LabelSmall } from "../typography";
import { ButtonLink, IconButton } from "../buttons";
import { Badge } from "../badge";
import { ButtonLink, IconButton } from "../buttons";
import { LogoPaymentWithFallback } from "../common/LogoPaymentWithFallback";
import { IOIconSizeScale, IOIcons, Icon } from "../icons";
import { IOLogoPaymentType } from "../logos";
import { H6, LabelSmall } from "../typography";

type ButtonLinkActionProps = {
type: "buttonLink";
Expand Down Expand Up @@ -41,6 +41,7 @@ export type ListItemInfo = WithTestID<{
endElement?: EndElementProps;
// Accessibility
accessibilityLabel?: string;
accessibilityRole?: AccessibilityRole;
}> &
(
| {
Expand All @@ -63,6 +64,7 @@ export const ListItemInfo = ({
paymentLogoIcon,
endElement,
accessibilityLabel,
accessibilityRole,
testID
}: ListItemInfo) => {
const theme = useIOTheme();
Expand Down Expand Up @@ -136,6 +138,7 @@ export const ListItemInfo = ({
testID={testID}
accessible={endElement === undefined ? true : false}
accessibilityLabel={listItemAccessibilityLabel}
accessibilityRole={accessibilityRole}
>
<View style={IOListItemStyles.listItemInner}>
{icon && (
Expand Down

0 comments on commit f68f4a6

Please sign in to comment.