Skip to content

Commit

Permalink
Merge pull request #3351 from dklymenk/3102-add-accessibility-role-an…
Browse files Browse the repository at this point in the history
…d-label-to-close-button

#3102 add accessibility role and label to close button
  • Loading branch information
mountiny authored Jun 4, 2021
2 parents 6923be0 + 2ea81f9 commit d534b5f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/HeaderWithCloseButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import styles from '../styles/styles';
import Header from './Header';
import Icon from './Icon';
import {Close, Download, BackArrow} from './Icon/Expensicons';
import compose from '../libs/compose';
import withLocalize, {withLocalizePropTypes} from './withLocalize';

const propTypes = {
/** Title of the Header */
Expand All @@ -29,6 +31,8 @@ const propTypes = {

/** Whether we should show a download button */
shouldShowDownloadButton: PropTypes.bool,

...withLocalizePropTypes,
};

const defaultProps = {
Expand Down Expand Up @@ -76,6 +80,8 @@ const HeaderWithCloseButton = props => (
<TouchableOpacity
onPress={props.onCloseButtonPress}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={props.translate('common.close')}
>
<Icon src={Close} />
</TouchableOpacity>
Expand All @@ -88,4 +94,4 @@ HeaderWithCloseButton.propTypes = propTypes;
HeaderWithCloseButton.defaultProps = defaultProps;
HeaderWithCloseButton.displayName = 'HeaderWithCloseButton';

export default HeaderWithCloseButton;
export default compose(withLocalize)(HeaderWithCloseButton);
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default {
delete: 'Delete',
contacts: 'Contacts',
recents: 'Recents',
close: 'Close',
},
attachmentPicker: {
cameraPermissionRequired: 'Camera Permission Required',
Expand Down
2 changes: 2 additions & 0 deletions src/pages/iou/IOUModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ class IOUModal extends Component {
<TouchableOpacity
onPress={() => Navigation.dismissModal()}
style={[styles.touchableButtonImage]}
accessibilityRole="button"
accessibilityLabel={this.props.translate('common.close')}
>
<Icon src={Close} />
</TouchableOpacity>
Expand Down

0 comments on commit d534b5f

Please sign in to comment.