-
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
Conversation
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.
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 } |
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.
Good call! sprintf
is not really necessary to add an extra space 👍
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.
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' ) } } |
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.
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 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 :)
Thanks for the review @etoledom ! Ready for another look |
Sorry forgot to remove one hint, removed with the last commit ⬆️ |
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.
Working beautifully 🎉
I restarted the CI, the failing tests seemed random. 🙏
* Enhance accessibility on toolbar buttons * Add accessibilityLabel for Image * Add accessibility on caption * Remove unnecessary hints * Update accessibility labels * Remove unnecessary hint
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: