Skip to content

Commit

Permalink
feat(fscomponents): add completed state accessibility label in Step
Browse files Browse the repository at this point in the history
  • Loading branch information
chukohsin authored and nathan-sankbeil committed Apr 22, 2019
1 parent 74836b6 commit 2434842
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/fscomponents/src/components/Step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import {
View,
ViewStyle
} from 'react-native';
import FSI18n, { translationKeys } from '@brandingbrand/fsi18n';

const componentTranslationKeys = translationKeys.flagship.step;

const styles = StyleSheet.create({
completedIcon: {
Expand Down Expand Up @@ -49,10 +52,16 @@ export interface StepProps {
export class Step extends Component<StepProps> {
render(): JSX.Element {
if (this.props.completed) {
const stepCompletedLabel =
FSI18n.string(componentTranslationKeys.announcements.stepCompleted);
const accessibilityLabel = `${this.props.title}, ${stepCompletedLabel}`;

return (
<TouchableOpacity
onPress={this.props.onPress}
style={[styles.container, this.props.style]}
accessibilityRole='button'
accessibilityLabel={accessibilityLabel}
>
{this.renderTitle()}
{this.renderDoneIcon()}
Expand Down
5 changes: 5 additions & 0 deletions packages/fsi18n/src/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ export const keys: FSTranslationKeys = {
summary: {
total: 'Total'
}
},
step: {
announcements: {
stepCompleted: 'Step Completed.'
}
}
}
};
7 changes: 7 additions & 0 deletions packages/fsi18n/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export interface FSTranslationKeys<KeyType = TranslationKey> extends Translation
storeLocator: StoreLocatorTranslations<KeyType>;
productIndex: ProductIndexTranslations<KeyType>;
checkout: CheckoutTranslations<KeyType>;
step: StepTranslations<KeyType>;
};
}

Expand Down Expand Up @@ -272,3 +273,9 @@ export interface CheckoutTranslations<KeyType> {
total: KeyType;
};
}

export interface StepTranslations<KeyType> {
announcements: {
stepCompleted: KeyType;
};
}

0 comments on commit 2434842

Please sign in to comment.