Skip to content

Commit

Permalink
[Mobile] Improving accessibility on Post title (#15106)
Browse files Browse the repository at this point in the history
* Add accessibilityLabel to post title

* Update accessibilityLabel

* Update accessibilityLabel

* Remove unnecessary line

* Import sprintf from i18n
  • Loading branch information
pinarol authored and hypest committed May 2, 2019
1 parent 5f793fb commit 72b7e5e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/editor/src/components/post-title/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* External dependencies
*/
import { View } from 'react-native';
import { isEmpty } from 'lodash';

/**
* WordPress dependencies
Expand All @@ -12,6 +13,7 @@ import { decodeEntities } from '@wordpress/html-entities';
import { withDispatch } from '@wordpress/data';
import { withFocusOutside } from '@wordpress/components';
import { withInstanceId, compose } from '@wordpress/compose';
import { __, sprintf } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -70,7 +72,11 @@ class PostTitle extends Component {
const borderColor = this.state.isSelected ? focusedBorderColor : 'transparent';

return (
<View style={ [ styles.titleContainer, borderStyle, { borderColor } ] }>
<View
style={ [ styles.titleContainer, borderStyle, { borderColor } ] }
accessible={ ! this.state.isSelected }
accessibilityLabel={ sprintf( '%s%s %s', __( 'Post title' ), __( '.' ), ( isEmpty( title ) ? __( 'Empty' ) : title ) ) }
>
<RichText
tagName={ 'p' }
rootTagsToEliminate={ [ 'strong' ] }
Expand Down

0 comments on commit 72b7e5e

Please sign in to comment.