-
Notifications
You must be signed in to change notification settings - Fork 91
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
Picture element images: Add missing alt text #1319
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
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.
It might need some test cases to be written/updated?
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.
Thanks @devansh016 for working on it. Left one question and code suggestion.
|
||
return sprintf( | ||
'<picture class="%s" style="display: contents;">%s%s</picture>', | ||
esc_attr( 'wp-picture-' . $attachment_id ), | ||
$picture_sources, | ||
$original_image_without_srcset | ||
$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.
@adamsilverstein As a fallback image, we should return the original image. In this MDN documentation, they return the original image instead of mime-type-specific images.
I couldn't find proper documentation for this. What do you think?
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.
Yes, I think this is right.
Also, I think the source
being generated for 'image/jpeg'
can also be removed as well, because if the browser doesn't support AVIF/WebP then it can just fall back to the img
which is a JPEG.
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.
performance/plugins/webp-uploads/picture-element.php
Lines 56 to 64 in 1ed2fbd
$enabled_mime_types = (array) apply_filters( | |
'webp_uploads_picture_element_mime_types', | |
array( | |
'image/avif', | |
'image/webp', | |
'image/jpeg', | |
), | |
$attachment_id | |
); |
Should we remove line 61
for the same.
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 think we can open a separate PR for this issue to avoid complicating the current one. This will allow us to address it more effectively.
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.
LGTM
Co-authored-by: Weston Ruter <[email protected]>
Summary
Fixes #1315
Relevant technical choices
For maintainers only, please make sure:
[Type]
label.no milestone
label if it does not apply to any specific plugin.skip changelog
label if it should not be mentioned in the plugin's changelog.-->