Skip to content
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

Merged
merged 6 commits into from
Apr 24, 2019

Conversation

pinarol
Copy link
Contributor

@pinarol pinarol commented Apr 23, 2019

Description

This PR improves accessibility on image block selected state.
Fixes part of: wordpress-mobile/gutenberg-mobile#909

To test:
Please refer to the gutenberg-mobile side PR.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

@pinarol pinarol added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label Apr 23, 2019
@pinarol pinarol requested a review from etoledom April 23, 2019 11:54
@pinarol pinarol self-assigned this Apr 23, 2019
Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job @pinarol ! 🎉

It's working great on iOS.

There is an issue on Android where the block-container blocks the focus of the image, when the block is selected. This is a generic issue on Android and it deserves its own PR.

After testing, I think it would be nice to add the caption information too to the unselected state of the block. It would read: "Image Block. {alt}. {caption}". What do you think?.

Not needed to add it in this PR since it's about the selected state.

Added a few code comments but in general it's great!

@@ -377,6 +380,8 @@ class ImageEdit extends React.Component {
resizeMethod="scale"
source={ { uri: url } }
key={ url }
accessible={ true }
accessibilityLabel={ __( 'Image' ) + __( '.' ) + ' ' + alt }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! sprintf is not really necessary to add an extra space 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On this particular case, I think the Image prefix is not necessary.
ImageBackground component uses an Image component internally that is already marked as an Image accessibility item. This makes VoiceOver read Image at the end, so it currently reads "Image. {Alt}. Image".

I'd say let's just add the Alt as label so it reads "{Alt}. Image".

icon="edit"
onClick={ onMediaOptionsButtonPressed }
extraProps={ { hint: __( 'Double tap to edit image' ) } }
Copy link
Contributor

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.

accessible={ true }
accessibilityLabel={ __( 'Image caption' ) + __( '.' ) + ' ' + ( isEmpty( caption ) ? __( 'Empty' ) : caption ) }
accessibilityHint={ __( 'Double tap to edit caption' ) }
accessibilityRole={ 'button' }
Copy link
Contributor

Choose a reason for hiding this comment

The 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 button it denotes that it's actionable. After the action the user gets in the text field on edit mode.

If we keep it, I'd add a the between edit and caption (Double tap to edit the caption). But better to ask someone English native to be sure :)

@pinarol
Copy link
Contributor Author

pinarol commented Apr 24, 2019

Thanks for the review @etoledom ! Ready for another look

@pinarol
Copy link
Contributor Author

pinarol commented Apr 24, 2019

Sorry forgot to remove one hint, removed with the last commit ⬆️

@etoledom etoledom self-requested a review April 24, 2019 09:30
Copy link
Contributor

@etoledom etoledom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Working beautifully 🎉

I restarted the CI, the failing tests seemed random. 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants