Skip to content

Commit 1619ebe

Browse files
feat: Add accessibilityLabel property to enhance accessibility for interaction components
1 parent c9e17de commit 1619ebe

File tree

6 files changed

+14
-4
lines changed

6 files changed

+14
-4
lines changed

src/components/card.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const Card = (props: NotificationCardProps): ReactElement => {
8383
<View style={style.cardIconContainer}>
8484
<TouchableOpacity
8585
disabled={Boolean(!onAvatarClick)}
86+
accessibilityLabel={`siren-notification-avatar-${notification.id}`}
8687
onPress={avatarClick}
8788
style={[style.cardIconRound, styles.cardIconRound]}
8889
>
@@ -101,7 +102,7 @@ const Card = (props: NotificationCardProps): ReactElement => {
101102

102103
const isSuccess = await onDelete(notification.id, false);
103104

104-
if (isSuccess)
105+
if (isSuccess)
105106
Animated.timing(opacity, {
106107
toValue: 0.1,
107108
duration: 300,
@@ -118,6 +119,7 @@ const Card = (props: NotificationCardProps): ReactElement => {
118119
onPress={cardClick}
119120
activeOpacity={0.6}
120121
testID='card-touchable'
122+
accessibilityLabel={`siren-notification-card-${notification.id}`}
121123
style={[style.cardWrapper, styles.cardWrapper, !notification?.isRead && styles.highlighted]}
122124
>
123125
<View

src/components/closeIcon.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const CloseIcon = ({
3434
onPress={() => onDelete(notification.id)}
3535
style={[style.closeButton, styles.closeButton]}
3636
testID='delete-button'
37+
accessibilityLabel={`siren-notification-delete${notification.id}`}
3738
>
3839
<>{icon}</>
3940
</TouchableOpacity>

src/components/errorWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const ErrorWindow = (props: {
3131
const iconStyle = { opacity: darkMode ? 0.6 : 1 };
3232

3333
return (
34-
<View style={[style.container, styles.container]}>
34+
<View accessibilityLabel='siren-error-state' style={[style.container, styles.container]}>
3535
{customErrorWindow || (
3636
<>
3737
<View style={[style.iconContainer, containerStyle]}>

src/components/header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const Header = (props: HeaderProps): ReactElement => {
5454
const renderBackButton = () => {
5555
if (showBackButton)
5656
return (
57-
<TouchableOpacity style={style.backIcon} onPress={onBackPress}>
57+
<TouchableOpacity accessibilityLabel='siren-header-back' style={style.backIcon} onPress={onBackPress}>
5858
{backButton || <BackIcon styles={styles} />}
5959
</TouchableOpacity>
6060
);
@@ -73,6 +73,7 @@ const Header = (props: HeaderProps): ReactElement => {
7373
{!hideClearAll && (
7474
<TouchableOpacity
7575
disabled={clearAllDisabled}
76+
accessibilityLabel='siren-header-clear-all'
7677
onPress={onPressClearAll}
7778
style={[style.clearIconContainer, clearAllDisabled && style.lowOpacity]}
7879
>

src/components/sirenInbox.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,11 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
296296
<ErrorWindow styles={styles} darkMode={darkMode} customErrorWindow={customErrorWindow} />
297297
);
298298

299-
return listEmptyComponent || <EmptyWindow styles={styles} darkMode={darkMode} />;
299+
return (
300+
<View style={style.container} accessibilityLabel='siren-empty-state'>
301+
{listEmptyComponent || <EmptyWindow styles={styles} darkMode={darkMode} />}
302+
</View>
303+
);
300304
}
301305

302306
return (
@@ -406,6 +410,7 @@ const SirenInbox = (props: SirenInboxProps): ReactElement => {
406410
removeClippedSubviews
407411
maxToRenderPerBatch={20}
408412
windowSize={3}
413+
accessibilityLabel='siren-notification-list'
409414
/>
410415
);
411416
};

src/components/sirenInboxIcon.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ const SirenInboxIcon = (props: SirenInboxIconProps) => {
151151
return (
152152
<TouchableOpacity
153153
testID='notification-icon'
154+
accessibilityLabel='siren-notification-icon'
154155
disabled={disabled}
155156
onPress={onPress}
156157
style={[styles.iconContainer, container]}

0 commit comments

Comments
 (0)