#62345 closed defect (bug) (fixed)
Issue on Google Chrome with lazy=load images = sizes=auto + css width: fit-content
Reported by: | mosne | Owned by: | flixos90 |
---|---|---|---|
Milestone: | 6.7 | Priority: | normal |
Severity: | normal | Version: | 6.7 |
Component: | Editor | Keywords: | has-patch |
Focuses: | css | Cc: |
Description
Bug Report
Description
WordPress 6.7 adds sizes=”auto” for lazy-loaded images.
On Chrome those images are rendered smaller.
this happens only in chrome. On Firefox and Safari the srcset is loaded correctly.
I would say that is more a Google Chrome issue than a WordPress issue... but better double check :)
Environment
- WordPress: 6.7-RC2-59332
- PHP: 7.4.30
- Server: Apache/2.4.43 (Unix)
- Database: mysqli (Server: 8.0.16 / Client: mysqlnd 7.4.30)
- Browser: Chrome 130.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.0
- MU Plugins: None activated
- Plugins:
- Create Block Theme 2.6.0
- Test Reports 1.1.0
- Theme Check 20231220
- WordPress Beta Tester 3.6.1
- WordPress Importer 0.8.3
Steps to Reproduce
- add to a page several large images
- the first 3 images are loaded without load=lazy for better performance
- 🐞 starting from the third (only in Chrome and only on the front office) the Bug occurs. the image size is smaller.
Expected Results
- all the images are loaded large
Actual Results
- ❌ the wrong size is loaded whene load=lazy + size=auto
Additional Notes
- removing the width:fit-content seems to fix the isseu
Supplemental Artifacts
- here a video of the bug
- also visible here at the end of the video (for ticket #62272)
https://kdrive.infomaniak.com/app/share/565596/5078577d-176e-4877-aa1c-edc96fe041f0
Change History (13)
This ticket was mentioned in Slack in #core by mosne. View the logs.
4 weeks ago
#2
@
4 weeks ago
- Component changed from General to Editor
- Keywords needs-patch added; needs-testing removed
- Milestone changed from Awaiting Review to 6.7
- Owner set to flixos90
- Status changed from new to assigned
#3
@
4 weeks ago
- Keywords has-patch added; needs-patch removed
This needs to be fixed in Gutenberg first and then backported, so I opened a PR in https://github.com/WordPress/gutenberg/pull/66801.
This ticket was mentioned in Slack in #core by flixos90. View the logs.
4 weeks ago
#5
@
4 weeks ago
Per discussion starting in https://github.com/WordPress/gutenberg/pull/66801#issuecomment-2460877322, potentially a better solution is a revert of the original fix, at least for the time being. The new CSS rule is too risky and already causing unexpected side effects.
#6
@
3 weeks ago
Thank you Paolo for reporting.
Thank you for looking into this @flixos90 - The original fix has been reverted here https://github.com/WordPress/gutenberg/pull/66804
#7
@
3 weeks ago
A new PR was created to remove the width: fit-content
property:
https://github.com/WordPress/gutenberg/pull/66804
It was cherry-picked to be included in the 6.7 release:
https://github.com/WordPress/gutenberg/commit/e503a390e8cbfabb28049babc97489eb0c3827e1
I performed some tests and the fit-content
removal seems to solve the small image issues in Chrome and Chromium-based browsers.
Edit: I didn't see the previous comment until I added my comment and refreshed, so apologies for re-stating the same.
#8
@
3 weeks ago
- Keywords close added
Thanks for confirming, @rcorrales. @flixos90 are we ok to close this as fixed?
#9
@
3 weeks ago
- Keywords close removed
- Resolution set to fixed
- Status changed from assigned to closed
Yes, thanks for the ping. The revert of the code introducing this bug was committed and backported to 6.7 via [59369].
Some updates:
contain-intrinsic-size: 300px 150px
from the UA stylesheet.width: content-fit
overrides thewidth
CSS property as inherited from the image'swidth
attribute, and that in combination with the UA stylesheet leads to the bug.@juanfra Based on https://github.com/WordPress/gutenberg/pull/66217, it looks like this change was implemented because of a problem in Firefox. However, as outlined above it introduces a problem in Chrome which however is not Chrome specific, but directly tied to the rule explained in the linked section of the HTML standard.
As such, I think we need to reconsider this fix, similar to how in https://github.com/WordPress/gutenberg/pull/66643 you already fixed it for SVG images. A potential solution would be to omit the
width: fit-content
for any images withloading="lazy"
andsizes="auto"
, in addition to how it's already omitted for SVG.