-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Try/featured image improvements with alt text #7267
Try/featured image improvements with alt text #7267
Conversation
This commit reproduces WordPress#3829, but with slightly better code. The rebase was also too complex.
Thanks for working on this. Should we continue work in this branch, or should we get #7200 finished and merged first, then rebase this off that? |
Yes let's get #7200 finished and merged first :) |
@@ -41,7 +44,10 @@ function PostFeaturedImage( { featuredImageId, onUpdateImage, onRemoveImage, med | |||
naturalWidth={ media.media_details.width } | |||
naturalHeight={ media.media_details.height } | |||
> | |||
<img src={ media.source_url } alt={ __( 'Featured image' ) } /> | |||
<img | |||
alt={ __( 'Replace featured image.' + featuredImageAltText( media.alt_text ) ) } |
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.
This won't work properly, you can't dynamically create a text that is passed to __()
function. This probably should be rewritten to:
alt={ __( 'Replace featured image.' ) + ' ' + featuredImageAltText( media.alt_text ) }
@@ -24,6 +24,9 @@ const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = __( 'Remove featured image' ); | |||
|
|||
function PostFeaturedImage( { featuredImageId, onUpdateImage, onRemoveImage, media, postType } ) { | |||
const postLabel = get( postType, [ 'labels' ], {} ); | |||
const featuredImageAltText = ( altText ) => { | |||
return altText ? ' Current image: ' + altText : ''; |
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.
This text needs to be wrapped with the translation helper.
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.
@gziolo I think I've fixed this, can you check if I've missed something
@jasmussen should we land it or close it? |
So, this PR is now so old that I have a hard time compiling it. I tried and got a number of errors with my docker install. The rephrasing could still make sense, but I think it might be good to see a GIF, or a fresh PR. |
@anevins12 would you mind updating this PR with the latest changes from the |
Let's close this one and start fresh as @jasmussen suggested. |
Description
Improved alternative text of featured images to describe the action of the button that wraps it, as well as identifies the featured image.
Branched off PR: #7200
How has this been tested?
npm run test
Types of changes
Checklist: