-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Avoid using width: fit-content for images that use auto-sizes #66801
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @EldarAgalarov. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. 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. |
Size Change: +96 B (+0.01%) Total Size: 1.82 MB
ℹ️ View Unchanged
|
Good investigation here, @felixarntz. I'd go further and suggest that adding Currently the image block doesn't add dimensions directly to the |
@felixarntz Too many avoids for this rule. This inconsistent rule should be removed at all. WP images worked without it for years. |
An alternative PR to remove fit-content has been created , see #66804 |
#66804 solve the issue and backported from GB. Once it committed we can close these PR. |
Thank you, all. |
I'll close this since #66804 was merged. |
Follow up to #66217 and #66643.
This fixes a bug reported in https://core.trac.wordpress.org/ticket/62345 that leads to incorrect display for images with
sizes="auto"
. See https://core.trac.wordpress.org/ticket/62345#comment:2 for details.What?
Exclude
width: content-fit
for images that usesizes="auto"
.Why?
Having
width: content-fit
on these images leads to a visual bug on browsers that supportsizes="auto"
, per the HTML specification https://html.spec.whatwg.org/multipage/rendering.html#img-contain-size.As this surfaces in the new Twenty Twenty-Five theme for instance and appears on heavily used browsers, I believe this is a critical visual bug and therefore needs to be fixed before the 6.7 release.
Testing Instructions
sizes="auto"
, e.g. Chrome (see https://caniuse.com/mdn-html_elements_img_sizes_auto).core/image
blocks, each width different images.sizes="auto"
) will be displayed with only 300px width. With this fix, they are displayed correctly.