-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mobile]Improve accessibility on image block selected state #15122
Changes from 3 commits
432547b
4265845
d0bd7d6
f8e0d6e
e766c4e
1661d06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import { | |
requestImageFailedRetryDialog, | ||
requestImageUploadCancelDialog, | ||
} from 'react-native-gutenberg-bridge'; | ||
import { isEmpty } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
|
@@ -254,9 +255,10 @@ class ImageEdit extends React.Component { | |
const toolbarEditButton = ( | ||
<Toolbar> | ||
<ToolbarButton | ||
label={ __( 'Edit image' ) } | ||
title={ __( 'Edit image' ) } | ||
icon="edit" | ||
onClick={ onMediaOptionsButtonPressed } | ||
extraProps={ { hint: __( 'Double tap to edit image' ) } } | ||
/> | ||
</Toolbar> | ||
); | ||
|
@@ -343,9 +345,10 @@ class ImageEdit extends React.Component { | |
</BlockControls> | ||
<InspectorControls> | ||
<ToolbarButton | ||
label={ __( 'Image Settings' ) } | ||
title={ __( 'Image Settings' ) } | ||
icon="admin-generic" | ||
onClick={ onImageSettingsButtonPressed } | ||
extraProps={ { hint: __( 'Double tap to open image settings' ) } } | ||
/> | ||
</InspectorControls> | ||
<ImageSize src={ url } > | ||
|
@@ -377,6 +380,8 @@ class ImageEdit extends React.Component { | |
resizeMethod="scale" | ||
source={ { uri: url } } | ||
key={ url } | ||
accessible={ true } | ||
accessibilityLabel={ __( 'Image' ) + __( '.' ) + ' ' + alt } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On this particular case, I think the I'd say let's just add the |
||
> | ||
{ this.state.isUploadFailed && | ||
<View style={ styles.imageContainer } > | ||
|
@@ -390,7 +395,13 @@ class ImageEdit extends React.Component { | |
} } | ||
</ImageSize> | ||
{ ( ! RichText.isEmpty( caption ) > 0 || isSelected ) && ( | ||
<View style={ { padding: 12, flex: 1 } }> | ||
<View | ||
style={ { padding: 12, flex: 1 } } | ||
accessible={ true } | ||
accessibilityLabel={ __( 'Image caption' ) + __( '.' ) + ' ' + ( isEmpty( caption ) ? __( 'Empty' ) : caption ) } | ||
accessibilityHint={ __( 'Double tap to edit caption' ) } | ||
accessibilityRole={ 'button' } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if the hint is really necessary here. Is true that from the label, it's not obvious that this can be edited, but as is marked as a If we keep it, I'd add a |
||
> | ||
<TextInput | ||
style={ { textAlign: 'center' } } | ||
fontFamily={ this.props.fontFamily || ( styles[ 'caption-text' ].fontFamily ) } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that the hint here is adding new information, so it's probably not needed.