Skip to content

Commit c9f6ba0

Browse files
committed
a11y: Make main tabs buttons accessible
This is the most important UI element remaining inaccessible. The buttons are currently icon-only and need accessibilityLabel. In addition to that, the IconUnreadConversations is enhanced with a readable (hearable) unread counts.
1 parent abf32ce commit c9f6ba0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/main/MainTabs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default TabNavigator(
1919
navigationOptions: {
2020
tabBarLabel: 'Home',
2121
tabBarIcon: (props: TabNavigationOptionsPropsType) => (
22-
<IconHome size={24} color={props.tintColor} />
22+
<IconHome accessibilityLabel="Unread" size={24} color={props.tintColor} />
2323
),
2424
},
2525
},
@@ -28,7 +28,7 @@ export default TabNavigator(
2828
navigationOptions: {
2929
tabBarLabel: 'Streams',
3030
tabBarIcon: (props: TabNavigationOptionsPropsType) => (
31-
<IconStream size={24} color={props.tintColor} />
31+
<IconStream accessibilityLabel="Streams" size={24} color={props.tintColor} />
3232
),
3333
},
3434
},
@@ -46,7 +46,7 @@ export default TabNavigator(
4646
navigationOptions: {
4747
tabBarLabel: 'Settings',
4848
tabBarIcon: (props: TabNavigationOptionsPropsType) => (
49-
<IconSettings size={24} color={props.tintColor} />
49+
<IconSettings accessibilityLabel="Settings" size={24} color={props.tintColor} />
5050
),
5151
},
5252
},

src/nav/IconUnreadConversations.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { StyleSheet } from 'react-native';
77
import { getUnreadPmsTotal, getUnreadHuddlesTotal } from '../selectors';
88
import { IconPeople } from '../common/Icons';
99
import { ComponentWithOverlay, UnreadCount } from '../common';
10+
import { textWithUnreadCount } from '../utils/accessibility';
1011

1112
const styles = StyleSheet.create({
1213
button: {
@@ -24,9 +25,11 @@ class IconUnreadConversations extends PureComponent<Props> {
2425
render() {
2526
const { unreadHuddlesTotal, unreadPmsTotal, color } = this.props;
2627
const unreadCount = unreadHuddlesTotal + unreadPmsTotal;
28+
const accessibilityLabel = textWithUnreadCount('Conversations', unreadCount);
2729

2830
return (
2931
<ComponentWithOverlay
32+
accessibilityLabel={accessibilityLabel}
3033
style={styles.button}
3134
overlaySize={15}
3235
showOverlay={unreadCount > 0}

0 commit comments

Comments
 (0)